FactoryGirl -> FactoryBot

This commit is contained in:
Petko Bordjukov 2019-04-28 01:25:13 +03:00
parent e2217d4d6e
commit fffcd8db2c
17 changed files with 53 additions and 54 deletions

View File

@ -79,7 +79,7 @@ end
group :development, :test do group :development, :test do
gem 'rspec-rails' gem 'rspec-rails'
gem 'factory_girl_rails' gem 'factory_bot_rails'
gem 'faker' gem 'faker'
gem 'capybara' gem 'capybara'
gem 'selenium-webdriver' gem 'selenium-webdriver'

View File

@ -122,11 +122,11 @@ GEM
erubi (1.8.0) erubi (1.8.0)
erubis (2.7.0) erubis (2.7.0)
execjs (2.7.0) execjs (2.7.0)
factory_girl (4.9.0) factory_bot (5.0.2)
activesupport (>= 3.0.0) activesupport (>= 4.2.0)
factory_girl_rails (4.9.0) factory_bot_rails (5.0.2)
factory_girl (~> 4.9.0) factory_bot (~> 5.0.2)
railties (>= 3.0.0) railties (>= 4.2.0)
faker (1.9.3) faker (1.9.3)
i18n (>= 0.7) i18n (>= 0.7)
faraday (0.15.4) faraday (0.15.4)
@ -415,7 +415,7 @@ DEPENDENCIES
delorean delorean
devise devise
devise-i18n devise-i18n
factory_girl_rails factory_bot_rails
faker faker
faraday faraday
font-awesome-sass (~> 4.6.2) font-awesome-sass (~> 4.6.2)

View File

@ -30,7 +30,7 @@ module Clarion
routing_specs: false, routing_specs: false,
request_specs: false request_specs: false
g.fixture_replacement :factory_girl, dir: 'spec/factories' g.fixture_replacement :factory_bot, dir: 'spec/factories'
end end
end end
end end

View File

@ -1,4 +1,4 @@
FactoryGirl.define do FactoryBot.define do
factory :call_for_participation do factory :call_for_participation do
end end
end end

View File

@ -1,22 +1,22 @@
# Read about factories at https://github.com/thoughtbot/factory_girl # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do FactoryBot.define do
factory :conference do factory :conference do
sequence(:title) { |n| "Conference-#{n}" } sequence(:title) { |n| "Conference-#{n}" }
email email
description 'MyText' description { 'MyText' }
start_date '2014-07-29 21:29:13' start_date { '2014-07-29 21:29:13' }
end_date '2014-07-31 21:29:13' end_date { '2014-07-31 21:29:13' }
planned_cfp_end_date '2014-07-28' planned_cfp_end_date { '2014-07-28' }
factory :past_conference do factory :past_conference do
start_date Date.today - 10.days start_date { Date.today - 10.days }
end_date Date.today - 5.days end_date { Date.today - 5.days }
end end
factory :future_conference do factory :future_conference do
start_date Date.today + 5.days start_date { Date.today + 5.days }
end_date Date.today + 10.days end_date { Date.today + 10.days }
end end
end end
end end

View File

@ -1,9 +1,9 @@
FactoryGirl.define do FactoryBot.define do
factory :event_type do factory :event_type do
name { |n| "Track #{n}" } name { |n| "Track #{n}" }
description 'MyText' description { 'MyText' }
conference conference
minimum_length '45' minimum_length { '45' }
maximum_length '60' maximum_length { '60' }
end end
end end

View File

@ -1,11 +1,11 @@
FactoryGirl.define do FactoryBot.define do
factory :event do factory :event do
title { |n| "Event #{n}" } title { |n| "Event #{n}" }
length { 60 } length { 60 }
abstract { 'foo' } abstract { 'foo' }
description { 'foo' } description { 'foo' }
conference conference
language :bg language { :bg }
after(:build) do |event, evaluator| after(:build) do |event, evaluator|
evaluator.conference.tracks << create(:track) evaluator.conference.tracks << create(:track)
event.track = evaluator.conference.tracks.first event.track = evaluator.conference.tracks.first

View File

@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do FactoryBot.define do
factory :hall do factory :hall do
name { |n| "Hall#{n}" } name { |n| "Hall#{n}" }
conference conference

View File

@ -1,7 +1,7 @@
FactoryGirl.define do FactoryBot.define do
factory :participation do factory :participation do
association :participant, factory: :user association :participant, factory: :user
event event
approved false approved { false }
end end
end end

View File

@ -1,14 +1,14 @@
FactoryGirl.define do FactoryBot.define do
factory :personal_profile do factory :personal_profile do
first_name 'Foo' first_name { 'Foo' }
last_name 'Bar' last_name { 'Bar' }
organisation 'foo inc.' organisation { 'foo inc.' }
public_email 'foo@example.com' public_email { 'foo@example.com' }
picture { Rack::Test::UploadedFile.new(File.join(Rails.root, 'spec', 'support', 'picture.jpg')) } picture { Rack::Test::UploadedFile.new(File.join(Rails.root, 'spec', 'support', 'picture.jpg')) }
mobile_phone '+359883444555' mobile_phone { '+359883444555' }
biography 'Just a bio' biography { 'Just a bio' }
github 'foobar' github { 'foobar' }
twitter 'foobar' twitter { 'foobar' }
user user
conference conference
end end

View File

@ -1,4 +1,4 @@
FactoryGirl.define do FactoryBot.define do
factory :proposition do factory :proposition do
association :proposer, factory: :user association :proposer, factory: :user
association :proposable, factory: :event association :proposable, factory: :event

View File

@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do FactoryBot.define do
factory :slot do factory :slot do
starts_at { Time.now } starts_at { Time.now }
ends_at { Time.now + 45.minutes } ends_at { Time.now + 45.minutes }

View File

@ -1,10 +1,10 @@
# Read about factories at https://github.com/thoughtbot/factory_girl # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do FactoryBot.define do
factory :track do factory :track do
name { |n| "Track#{n}" } name { |n| "Track#{n}" }
color '#000000' color { '#000000' }
description 'Some description' description { 'Some description' }
conference conference
end end
end end

View File

@ -1,16 +1,16 @@
# Read about factories at https://github.com/thoughtbot/factory_girl # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do FactoryBot.define do
sequence(:email) { |n| "user-#{n}@example.org" } sequence(:email) { |n| "user-#{n}@example.org" }
factory :user do factory :user do
password 'password' password { 'password' }
password_confirmation 'password' password_confirmation { 'password' }
confirmed_at Time.now - 15.minutes confirmed_at { Time.now - 15.minutes }
email email
factory :administrator do factory :administrator do
admin true admin { true }
end end
end end
end end

View File

@ -1,7 +1,6 @@
FactoryGirl.define do FactoryBot.define do
factory :volunteership do factory :volunteership do
volunteer_team nil volunteer_team { nil }
volunteer nil volunteer { nil }
end end
end end

View File

@ -0,0 +1,4 @@
RSpec.configure do |config|
# Include the FactoryBot methods
config.include FactoryBot::Syntax::Methods
end

View File

@ -1,4 +0,0 @@
RSpec.configure do |config|
# Include the FactoryGirl methods
config.include FactoryGirl::Syntax::Methods
end