From d839bed40fb7901ea88395d4ba06e58f4b3cc88a Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 8 Dec 2017 18:27:24 +0100 Subject: upgrade: factory_girl -> factory_bot --- test/support/api_integration_test.rb | 2 +- test/support/browser_integration_test.rb | 2 +- test/support/stub_record_helper.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test/support') diff --git a/test/support/api_integration_test.rb b/test/support/api_integration_test.rb index 7942558..94c88e1 100644 --- a/test/support/api_integration_test.rb +++ b/test/support/api_integration_test.rb @@ -22,7 +22,7 @@ class ApiIntegrationTest < ActionDispatch::IntegrationTest @testcode = InviteCode.new @testcode.save! options.reverse_merge! invite_code: @testcode.invite_code - FactoryGirl.create :user, options + FactoryBot.create :user, options end teardown do diff --git a/test/support/browser_integration_test.rb b/test/support/browser_integration_test.rb index d00e606..cff732b 100644 --- a/test/support/browser_integration_test.rb +++ b/test/support/browser_integration_test.rb @@ -49,7 +49,7 @@ class BrowserIntegrationTest < RackStackTest # ApiIntegrationTest has a working implementation for RackTest def login(user = nil) InviteCodeValidator.any_instance.stubs(:validate) - @user ||= user ||= FactoryGirl.create(:user) + @user ||= user ||= FactoryBot.create(:user) token = Token.create user_id: user.id page.driver.add_header "Authorization", %Q(Token token="#{token}") visit '/' diff --git a/test/support/stub_record_helper.rb b/test/support/stub_record_helper.rb index 25138a0..4d74f2a 100644 --- a/test/support/stub_record_helper.rb +++ b/test/support/stub_record_helper.rb @@ -26,7 +26,7 @@ module StubRecordHelper if record_or_method_hash && !record_or_method_hash.is_a?(Hash) return record_or_method_hash end - FactoryGirl.build_stubbed(factory).tap do |record| + FactoryBot.build_stubbed(factory).tap do |record| if persisted or record.persisted? record_or_method_hash.reverse_merge! :created_at => Time.now, :updated_at => Time.now, :id => Random.rand(100000).to_s @@ -38,7 +38,7 @@ module StubRecordHelper # returns deep stringified attributes so they can be compared to # what the controller receives as params def record_attributes_for(factory, attribs_hash = nil) - FactoryGirl.attributes_for(factory, attribs_hash).tap do |attribs| + FactoryBot.attributes_for(factory, attribs_hash).tap do |attribs| attribs.keys.each do |key| val = attribs.delete(key) attribs[key.to_s] = val.is_a?(Hash) ? val.stringify_keys! : val -- cgit v1.2.3