Skip to content

Commit

Permalink
Merge pull request #352 from doubleunion/update-to-factory_bot
Browse files Browse the repository at this point in the history
Update to factory bot
  • Loading branch information
compwron committed Jun 17, 2019
2 parents 893391b + e9ef9e3 commit 6981791
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ group :test do
gem 'chromedriver-helper'
gem 'database_cleaner'
gem 'email_spec'
gem 'factory_girl_rails'
gem 'factory_bot_rails', '~> 4'
gem 'launchy'
gem 'rspec-collection_matchers'
gem 'selenium-webdriver'
Expand Down
34 changes: 17 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@ GEM
archive-zip (0.12.0)
io-like (~> 0.3.0)
arel (6.0.4)
autoprefixer-rails (9.5.1.1)
autoprefixer-rails (9.6.0)
execjs
awesome_print (1.8.0)
aws-eventstream (1.0.3)
aws-partitions (1.167.0)
aws-sdk-core (3.53.1)
aws-partitions (1.175.0)
aws-sdk-core (3.55.0)
aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-rails (2.1.0)
aws-sdk-ses (~> 1)
railties (>= 3)
aws-sdk-ses (1.21.0)
aws-sdk-ses (1.22.0)
aws-sdk-core (~> 3, >= 3.53.0)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.1.0)
Expand All @@ -78,7 +78,7 @@ GEM
bugsnag (6.11.1)
concurrent-ruby (~> 1.0)
builder (3.2.3)
capybara (3.21.0)
capybara (3.24.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
Expand Down Expand Up @@ -116,10 +116,10 @@ GEM
erubis (2.7.0)
eventmachine (1.2.7)
execjs (2.7.0)
factory_girl (4.9.0)
factory_bot (4.11.1)
activesupport (>= 3.0.0)
factory_girl_rails (4.9.0)
factory_girl (~> 4.9.0)
factory_bot_rails (4.11.1)
factory_bot (~> 4.11.1)
railties (>= 3.0.0)
faker (1.9.3)
i18n (>= 0.7)
Expand Down Expand Up @@ -157,7 +157,7 @@ GEM
jquery-rails
railties (>= 3.1)
sass-rails
jquery-rails (4.3.3)
jquery-rails (4.3.5)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
Expand Down Expand Up @@ -204,7 +204,7 @@ GEM
omniauth-github (1.3.0)
omniauth (~> 1.5)
omniauth-oauth2 (>= 1.4.0, < 2.0)
omniauth-google-oauth2 (0.6.1)
omniauth-google-oauth2 (0.7.0)
jwt (>= 2.0)
omniauth (>= 1.1.1)
omniauth-oauth2 (>= 1.5)
Expand Down Expand Up @@ -274,12 +274,12 @@ GEM
regexp_parser (1.5.1)
rspec-collection_matchers (1.1.3)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.8.0)
rspec-core (3.8.1)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.3)
rspec-expectations (3.8.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
rspec-mocks (3.8.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-rails (3.8.2)
Expand All @@ -290,7 +290,7 @@ GEM
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rspec-support (3.8.2)
ruby_parser (3.13.1)
sexp_processor (~> 4.9)
rubyzip (1.2.3)
Expand All @@ -311,8 +311,8 @@ GEM
selenium-webdriver (3.142.3)
childprocess (>= 0.5, < 2.0)
rubyzip (~> 1.2, >= 1.2.2)
sexp_processor (4.12.0)
shoulda-matchers (4.0.1)
sexp_processor (4.12.1)
shoulda-matchers (4.1.0)
activesupport (>= 4.2.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -373,7 +373,7 @@ DEPENDENCIES
database_cleaner
email_spec
execjs
factory_girl_rails
factory_bot_rails (~> 4)
faker
figaro
haml-rails
Expand Down
42 changes: 21 additions & 21 deletions spec/factories.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FactoryGirl.define do
FactoryBot.define do
factory :user do
name { "#{Faker::Name.first_name.gsub("'", "")} #{Faker::Name.last_name.gsub("'", "")}" }
sequence(:email) { |n| "example#{n}@example.com" }
username { "#{name[0..3]}_#{Faker::Internet.domain_word}"}

factory :member do
state "member"
state { "member" }

factory :mature_member do
after(:create) do |user|
Expand All @@ -16,35 +16,35 @@

factory :setup_complete_member do
sequence(:email_for_google) { |n| "googleemail#{n}@example.com" }
dues_pledge [10, 25, 50].sample
stripe_customer_id "123abc"
setup_complete true
dues_pledge { [10, 25, 50].sample }
stripe_customer_id { "123abc" }
setup_complete { true }
end
end

factory :key_member do
state 'key_member'
state { 'key_member' }
end

factory :voting_member do
state "voting_member"
voting_policy_agreement true
state { "voting_member" }
voting_policy_agreement { true }
end

factory :applicant do
state "applicant"
state { "applicant" }
end

factory :admin do
is_admin true
state "voting_member"
is_admin { true }
state { "voting_member" }
end
end

factory :vote do
association :user, factory: :voting_member
application
value false
value { false }
end

factory :sponsorship do
Expand All @@ -54,22 +54,22 @@

factory :application do
association :user, factory: :applicant
state "submitted"
agreement_terms true
agreement_policies true
agreement_female true
state { "submitted" }
agreement_terms { true }
agreement_policies { true }
agreement_female { true }

factory :unsubmitted_application do
state "started"
state { "started" }
end

factory :stale_application do
stale_email_sent_at nil
stale_email_sent_at { nil }
submitted_at { 14.days.ago }
end

factory :approvable_application do
submitted_at 7.days.ago
submitted_at { 7.days.ago }

after(:create) do |application, _|
create_list(:vote, Application.minimum_yes_votes, application: application, value: true)
Expand All @@ -93,7 +93,7 @@
factory :comment do
association :application, factory: :application
association :user, factory: :member
body 'comment body'
created_at 1.day.ago
body { 'comment body' }
created_at { 1.day.ago }
end
end
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
RSpec.configure do |config|
config.include(EmailSpec::Helpers)
config.include(EmailSpec::Matchers)
config.include FactoryGirl::Syntax::Methods
config.include FactoryBot::Syntax::Methods

config.infer_spec_type_from_file_location!

Expand Down

0 comments on commit 6981791

Please sign in to comment.