Fix FactoryGirl deprecation warning by upgrading to FactoryBot 5
This commit is contained in:
parent
051cd9a265
commit
ac64fed6a8
11 changed files with 24 additions and 24 deletions
2
Gemfile
2
Gemfile
|
@ -64,7 +64,7 @@ group :development, :test do
|
|||
gem 'byebug'
|
||||
# Yay tests
|
||||
gem 'rspec-rails'
|
||||
gem 'factory_girl_rails'
|
||||
gem 'factory_bot_rails'
|
||||
gem 'faker'
|
||||
gem 'listen'
|
||||
end
|
||||
|
|
12
Gemfile.lock
12
Gemfile.lock
|
@ -112,11 +112,11 @@ GEM
|
|||
erubi (1.7.1)
|
||||
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.8.7)
|
||||
i18n (>= 0.7)
|
||||
faraday (0.12.2)
|
||||
|
@ -359,7 +359,7 @@ DEPENDENCIES
|
|||
coveralls
|
||||
devise
|
||||
ed25519
|
||||
factory_girl_rails
|
||||
factory_bot_rails
|
||||
faker
|
||||
friendly_id (~> 5.1.0)
|
||||
haml-rails
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
unless Rails.env.production?
|
||||
require 'factory_girl'
|
||||
require 'factory_bot'
|
||||
require 'faker'
|
||||
task :sow => :environment do
|
||||
users = FactoryGirl.create_list(:user, 20)
|
||||
users = FactoryBot.create_list(:user, 20)
|
||||
100.times do
|
||||
sample_users = users.sample(2)
|
||||
FactoryGirl.create :transaction, debtor: sample_users[0], creditor: sample_users[1]
|
||||
FactoryBot.create :transaction, debtor: sample_users[0], creditor: sample_users[1]
|
||||
end
|
||||
clients = FactoryGirl.create_list(:client, 5)
|
||||
clients = FactoryBot.create_list(:client, 5)
|
||||
100.times do
|
||||
debtor, creditor = users.sample(2)
|
||||
FactoryGirl.create :client_transaction, issuer: clients.sample, debtor: debtor, creditor: creditor
|
||||
FactoryBot.create :client_transaction, issuer: clients.sample, debtor: debtor, creditor: creditor
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :android_device_registration_token do
|
||||
token "MyString"
|
||||
user nil
|
||||
token { Faker::Lorem.word }
|
||||
association :user
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# updated_at :datetime not null
|
||||
#
|
||||
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :client do
|
||||
name { Faker::Lorem.word }
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# updated_at :datetime not null
|
||||
#
|
||||
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :notification do
|
||||
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# updated_at :datetime not null
|
||||
#
|
||||
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :request do
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :role do
|
||||
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# id_at_client :integer
|
||||
#
|
||||
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :transaction do
|
||||
association :debtor, factory: :user
|
||||
association :creditor, factory: :user
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
# updated_at :datetime not null
|
||||
#
|
||||
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :user do
|
||||
name { Faker::Internet.user_name }
|
||||
|
||||
factory :penning do
|
||||
penning true
|
||||
penning { true }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ Coveralls.wear!('rails')
|
|||
# users commonly want.
|
||||
#
|
||||
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
||||
require 'factory_girl'
|
||||
require 'factory_bot'
|
||||
require 'devise'
|
||||
|
||||
Dir[File.join(File.dirname(__FILE__), 'support', '**', '*.rb')].each do |f|
|
||||
|
@ -30,7 +30,7 @@ Dir[File.join(File.dirname(__FILE__), 'support', '**', '*.rb')].each do |f|
|
|||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.include FactoryGirl::Syntax::Methods
|
||||
config.include FactoryBot::Syntax::Methods
|
||||
config.include Devise::TestHelpers, type: :controller
|
||||
|
||||
# rspec-expectations config goes here. You can use an alternate
|
||||
|
|
Loading…
Reference in a new issue