Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Factorybot #1197

Merged
merged 12 commits into from
Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@ group :development, :test do

# testing
# gem 'spring'
gem 'factory_bot_rails'
gem 'faker'
gem 'fuzz_ball'
gem 'guard'
gem 'guard-minitest'
gem 'minitest'
gem 'minitest-focus'
gem 'minitest-rails'
gem 'minitest-reporters'
gem 'minitest-reporters', '1.1.18'
gem 'mocha', '>= 1.5'
gem 'pry'
gem 'pry-byebug'
gem 'pry-remote'

gem 'rubocop', require: false
Expand Down
21 changes: 16 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ GEM
encryptor (~> 3.0.0)
bcrypt (3.1.11)
builder (3.2.3)
byebug (10.0.2)
codeclimate-test-reporter (1.0.8)
simplecov (<= 0.13)
coderay (1.1.1)
Expand All @@ -104,8 +105,13 @@ GEM
docile (1.1.5)
encryptor (3.0.0)
erubi (1.7.0)
faker (1.7.3)
i18n (~> 0.5)
factory_bot (4.10.0)
activesupport (>= 3.0.0)
factory_bot_rails (4.10.0)
factory_bot (~> 4.10.0)
railties (>= 3.0.0)
faker (1.9.1)
i18n (>= 0.7)
faraday (0.11.0)
multipart-post (>= 1.2, < 3)
faraday-http-cache (2.0.0)
Expand Down Expand Up @@ -137,7 +143,7 @@ GEM
guard-compat (~> 1.2)
minitest (>= 3.0)
hashie (3.5.5)
i18n (0.9.1)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
json (2.1.0)
jwt (1.5.6)
Expand All @@ -155,7 +161,7 @@ GEM
method_source (0.8.2)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.1)
minitest (5.11.3)
minitest-focus (1.1.2)
minitest (>= 4, < 6)
minitest-rails (3.0.0)
Expand Down Expand Up @@ -203,6 +209,9 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-byebug (3.6.0)
byebug (~> 10.0)
pry (~> 0.10)
pry-remote (0.1.8)
pry (~> 0.9)
slop (~> 3.0)
Expand Down Expand Up @@ -293,6 +302,7 @@ DEPENDENCIES
attr_encrypted
codeclimate-test-reporter
devise_token_auth!
factory_bot_rails
faker
figaro!
fuzz_ball
Expand All @@ -302,14 +312,15 @@ DEPENDENCIES
minitest
minitest-focus
minitest-rails
minitest-reporters
minitest-reporters (= 1.1.18)
mocha (>= 1.5)
mysql2
omniauth-facebook!
omniauth-github!
omniauth-google-oauth2!
pg
pry
pry-byebug
pry-remote
rack-cors
rails-controller-testing
Expand Down
59 changes: 29 additions & 30 deletions gemfiles/rails_4_2.gemfile
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'
source "https://rubygems.org"

gem 'mysql2', '~> 0.4.10'
gem 'pg', '~> 0.21'
gem 'rails', '~> 4.2.10'
gem "mysql2", "~> 0.4.10"
gem "pg", "~> 0.21"
gem "rails", "~> 4.2.10"

group :development, :test do
gem 'attr_encrypted'
gem 'figaro', git: 'https://github.com/laserlemon/figaro'
gem 'omniauth-facebook', git: 'https://github.com/mkdynamic/omniauth-facebook'
gem 'omniauth-github', git: 'https://github.com/intridea/omniauth-github'
gem 'omniauth-google-oauth2', git: 'https://github.com/zquestz/omniauth-google-oauth2'
gem 'rack-cors', require: 'rack/cors'
gem 'thor'
gem 'faker'
gem 'fuzz_ball'
gem 'guard'
gem 'guard-minitest'
gem 'minitest'
gem 'minitest-focus'
gem 'minitest-rails'
gem 'minitest-reporters'
gem 'mocha', '>= 1.5'
gem 'pry'
gem 'pry-remote'

gem 'rubocop', require: false
gem "attr_encrypted"
gem "figaro", git: "https://github.com/laserlemon/figaro"
gem "omniauth-facebook", git: "https://github.com/mkdynamic/omniauth-facebook"
gem "omniauth-github", git: "https://github.com/intridea/omniauth-github"
gem "omniauth-google-oauth2", git: "https://github.com/zquestz/omniauth-google-oauth2"
gem "rack-cors", require: "rack/cors"
gem "thor"
gem "factory_bot_rails"
gem "faker"
gem "fuzz_ball"
gem "guard"
gem "guard-minitest"
gem "minitest"
gem "minitest-focus"
gem "minitest-rails"
gem "minitest-reporters", "1.1.18"
gem "mocha", ">= 1.5"
gem "pry"
gem "pry-byebug"
gem "pry-remote"
gem "rubocop", require: false
end

group :test do
gem 'codeclimate-test-reporter', require: nil
gem 'rails-controller-testing'
gem "codeclimate-test-reporter", require: nil
gem "rails-controller-testing"
end

group :development do
gem 'github_changelog_generator'
gem "github_changelog_generator"
end

gemspec path: '../'
gemspec path: "../"
55 changes: 27 additions & 28 deletions gemfiles/rails_5_0.gemfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'
source "https://rubygems.org"

gem 'rails', '~> 5.0.7'
gem "rails", "~> 5.0.7"

group :development, :test do
gem 'attr_encrypted'
gem 'figaro', git: 'https://github.com/laserlemon/figaro'
gem 'omniauth-facebook', git: 'https://github.com/mkdynamic/omniauth-facebook'
gem 'omniauth-github', git: 'https://github.com/intridea/omniauth-github'
gem 'omniauth-google-oauth2', git: 'https://github.com/zquestz/omniauth-google-oauth2'
gem 'rack-cors', require: 'rack/cors'
gem 'thor'
gem 'faker'
gem 'fuzz_ball'
gem 'guard'
gem 'guard-minitest'
gem 'minitest'
gem 'minitest-focus'
gem 'minitest-rails'
gem 'minitest-reporters'
gem 'mocha', '>= 1.5'
gem 'pry'
gem 'pry-remote'

gem 'rubocop', require: false
gem "attr_encrypted"
gem "figaro", git: "https://github.com/laserlemon/figaro"
gem "omniauth-facebook", git: "https://github.com/mkdynamic/omniauth-facebook"
gem "omniauth-github", git: "https://github.com/intridea/omniauth-github"
gem "omniauth-google-oauth2", git: "https://github.com/zquestz/omniauth-google-oauth2"
gem "rack-cors", require: "rack/cors"
gem "thor"
gem "factory_bot_rails"
gem "faker"
gem "fuzz_ball"
gem "guard"
gem "guard-minitest"
gem "minitest"
gem "minitest-focus"
gem "minitest-rails"
gem "minitest-reporters", "1.1.18"
gem "mocha", ">= 1.5"
gem "pry"
gem "pry-byebug"
gem "pry-remote"
gem "rubocop", require: false
end

group :test do
gem 'codeclimate-test-reporter', require: nil
gem 'rails-controller-testing'
gem "codeclimate-test-reporter", require: nil
gem "rails-controller-testing"
end

group :development do
gem 'github_changelog_generator'
gem "github_changelog_generator"
end

gemspec path: '../'
gemspec path: "../"
55 changes: 27 additions & 28 deletions gemfiles/rails_5_1.gemfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'
source "https://rubygems.org"

gem 'rails', '~> 5.1.6'
gem "rails", "~> 5.1.6"

group :development, :test do
gem 'attr_encrypted'
gem 'figaro', git: 'https://github.com/laserlemon/figaro'
gem 'omniauth-facebook', git: 'https://github.com/mkdynamic/omniauth-facebook'
gem 'omniauth-github', git: 'https://github.com/intridea/omniauth-github'
gem 'omniauth-google-oauth2', git: 'https://github.com/zquestz/omniauth-google-oauth2'
gem 'rack-cors', require: 'rack/cors'
gem 'thor'
gem 'faker'
gem 'fuzz_ball'
gem 'guard'
gem 'guard-minitest'
gem 'minitest'
gem 'minitest-focus'
gem 'minitest-rails'
gem 'minitest-reporters'
gem 'mocha', '>= 1.5'
gem 'pry'
gem 'pry-remote'

gem 'rubocop', require: false
gem "attr_encrypted"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why going back with double quotes? we fixed this with rubocop

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bundle exec appraisal install generates gem sets. I think the command is the reason. I could replace double quotes with editor. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well if it will happen all the time due to be autogenerated, leave as it is. I will continue reviewing this

gem "figaro", git: "https://github.com/laserlemon/figaro"
gem "omniauth-facebook", git: "https://github.com/mkdynamic/omniauth-facebook"
gem "omniauth-github", git: "https://github.com/intridea/omniauth-github"
gem "omniauth-google-oauth2", git: "https://github.com/zquestz/omniauth-google-oauth2"
gem "rack-cors", require: "rack/cors"
gem "thor"
gem "factory_bot_rails"
gem "faker"
gem "fuzz_ball"
gem "guard"
gem "guard-minitest"
gem "minitest"
gem "minitest-focus"
gem "minitest-rails"
gem "minitest-reporters", "1.1.18"
gem "mocha", ">= 1.5"
gem "pry"
gem "pry-byebug"
gem "pry-remote"
gem "rubocop", require: false
end

group :test do
gem 'codeclimate-test-reporter', require: nil
gem 'rails-controller-testing'
gem "codeclimate-test-reporter", require: nil
gem "rails-controller-testing"
end

group :development do
gem 'github_changelog_generator'
gem "github_changelog_generator"
end

gemspec path: '../'
gemspec path: "../"
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

class Custom::ConfirmationsControllerTest < ActionController::TestCase
describe Custom::ConfirmationsController do
include CustomControllersRoutes

before do
@redirect_url = Faker::Internet.url
@new_user = users(:unconfirmed_email_user)
@new_user = create(:user)
@new_user.send_confirmation_instructions(redirect_url: @redirect_url)
@mail = ActionMailer::Base.deliveries.last
@token = @mail.body.match(/confirmation_token=([^&]*)&/)[1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

class Custom::OmniauthCallbacksControllerTest < ActionDispatch::IntegrationTest
describe Custom::OmniauthCallbacksController do
include CustomControllersRoutes

setup do
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new(
Expand Down
6 changes: 4 additions & 2 deletions test/controllers/custom/custom_passwords_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

class Custom::PasswordsControllerTest < ActionController::TestCase
describe Custom::PasswordsController do
include CustomControllersRoutes

before do
@resource = users(:confirmed_email_user)
@resource = create(:user, :confirmed)
@redirect_url = 'http://ng-token-auth.dev'
end

Expand All @@ -26,7 +28,7 @@ class Custom::PasswordsControllerTest < ActionController::TestCase
end

test 'yield resource to block on edit success' do
@resource = users(:unconfirmed_email_user)
@resource = create(:user)
@redirect_url = 'http://ng-token-auth.dev'

post :create,
Expand Down
14 changes: 6 additions & 8 deletions test/controllers/custom/custom_registrations_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@

class Custom::RegistrationsControllerTest < ActionDispatch::IntegrationTest
describe Custom::RegistrationsController do
setup do
@create_params = {
email: Faker::Internet.email,
password: 'secret123',
password_confirmation: 'secret123',
include CustomControllersRoutes

before do
@create_params = attributes_for(:user,
confirm_success_url: Faker::Internet.url,
unpermitted_param: '(x_x)'
}
unpermitted_param: '(x_x)')

@existing_user = nice_users(:confirmed_email_user)
@existing_user = create(:user, :confirmed)
@auth_headers = @existing_user.create_new_auth_token
@client_id = @auth_headers['client']

Expand Down
Loading