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
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'factory_bot_rails'
gem 'faker'
gem 'capybara'
gem 'selenium-webdriver'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,6 @@
FactoryGirl.define do
FactoryBot.define do
factory :volunteership do
volunteer_team nil
volunteer nil
volunteer_team { nil }
volunteer { nil }
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