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/functional/identities_controller_test.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'test/functional/identities_controller_test.rb') diff --git a/test/functional/identities_controller_test.rb b/test/functional/identities_controller_test.rb index 5af2e88..5e46f9c 100644 --- a/test/functional/identities_controller_test.rb +++ b/test/functional/identities_controller_test.rb @@ -1,4 +1,4 @@ -require_relative '../test_helper' +require 'test_helper' class IdentitiesControllerTest < ActionController::TestCase @@ -26,7 +26,7 @@ class IdentitiesControllerTest < ActionController::TestCase test "admin can unblock username" do # an identity without user_id and destination is a blocked handle - identity = FactoryGirl.create :identity + identity = create_identity login :is_admin? => true delete :destroy, id: identity.id assert_response :redirect @@ -34,13 +34,19 @@ class IdentitiesControllerTest < ActionController::TestCase end test "admin cannot remove main identity" do - user = FactoryGirl.create :user - identity = FactoryGirl.create :identity, - Identity.attributes_from_user(user) + user = create_user + identity = create_identity Identity.attributes_from_user(user) login :is_admin? => true delete :destroy, id: identity.id assert_response :redirect assert_equal identity, Identity.find(identity.id) end + def create_identity(attrs={}) + FactoryBot.create :identity, attrs + end + + def create_user + FactoryBot.create :user + end end -- cgit v1.2.3