From 4e716cea253be9293b247fbe74d25fe288b7853f Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 30 Dec 2012 22:03:10 +0100 Subject: Converted Factory to FactoryGirl. --- test/unit/user_test.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'test/unit/user_test.rb') diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index bb89e77..5fa1e4a 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -3,21 +3,21 @@ require 'test_helper' class UserTest < ActiveSupport::TestCase def test_should_have_a_valid_factory - assert Factory.build(:user).valid? + assert FactoryGirl.build(:user).valid? end def test_should_have_a_unique_email_address - user = Factory.create(:user) - assert !Factory.build(:user, :email => user.email).valid? - assert Factory.build(:user, :email => "different_#{user.email}").valid? + user = FactoryGirl.create(:user) + assert !FactoryGirl.build(:user, :email => user.email).valid? + assert FactoryGirl.build(:user, :email => "different_#{user.email}").valid? end def test_can_not_move_to_a_current_tenant_without_a_membership_relation - super_tenant = Factory.create(:tenant) - good_tenant = Factory.create(:tenant) - evil_tenant = Factory.create(:tenant) + super_tenant = FactoryGirl.create(:tenant) + good_tenant = FactoryGirl.create(:tenant) + evil_tenant = FactoryGirl.create(:tenant) - user = Factory.create(:user) + user = FactoryGirl.create(:user) super_tenant.tenant_memberships.create(:user_id => user.id) good_tenant.tenant_memberships.create(:user_id => user.id) @@ -27,7 +27,7 @@ class UserTest < ActiveSupport::TestCase end test "should be possible to modify the user without changing the PIN" do - user = Factory.create(:user) + user = FactoryGirl.create(:user) pin_salt = user.pin_salt pin_hash = user.pin_hash user.middle_name = "#{user.middle_name} Foo" @@ -39,7 +39,7 @@ class UserTest < ActiveSupport::TestCase end test "should be possible to change the PIN" do - user = Factory.create(:user) + user = FactoryGirl.create(:user) pin_salt = user.pin_salt pin_hash = user.pin_hash new_pin = '453267' @@ -52,7 +52,7 @@ class UserTest < ActiveSupport::TestCase end test "should not be possible to change the PIN if the confirmation does not match" do - user = Factory.create(:user) + user = FactoryGirl.create(:user) pin_salt = user.pin_salt pin_hash = user.pin_hash user.new_pin = '123001' @@ -67,7 +67,7 @@ class UserTest < ActiveSupport::TestCase end test "PIN must be numeric" do - user = Factory.create(:user) + user = FactoryGirl.create(:user) new_pin = 'xxxx' user.new_pin = new_pin user.new_pin_confirmation = new_pin -- cgit v1.2.3