summaryrefslogtreecommitdiff
path: root/test/unit/phone_book_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/phone_book_test.rb')
-rw-r--r--test/unit/phone_book_test.rb44
1 files changed, 22 insertions, 22 deletions
diff --git a/test/unit/phone_book_test.rb b/test/unit/phone_book_test.rb
index 7db48f8..b820521 100644
--- a/test/unit/phone_book_test.rb
+++ b/test/unit/phone_book_test.rb
@@ -2,15 +2,15 @@ require 'test_helper'
class PhoneBookTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:phone_book).valid?
+ assert FactoryGirl.build(:phone_book).valid?
end
def test_should_have_unique_name_depending_on_type
- user1 = Factory.create(:user)
- user2 = Factory.create(:user)
- tenant = Factory.create(:tenant)
+ user1 = FactoryGirl.create(:user)
+ user2 = FactoryGirl.create(:user)
+ tenant = FactoryGirl.create(:tenant)
- phonebook = Factory.create(:phone_book, :phone_bookable => user1)
+ phonebook = FactoryGirl.create(:phone_book, :phone_bookable => user1)
assert !user1.phone_books.build(:name => phonebook.name).valid?
assert user2.phone_books.build(:name => phonebook.name).valid?
assert tenant.phone_books.build(:name => phonebook.name).valid?
@@ -20,7 +20,7 @@ class PhoneBookTest < ActiveSupport::TestCase
# test "User gets a private phone book with rw rights" do
- # user = Factory.create(:user)
+ # user = FactoryGirl.create(:user)
# assert_equal 1, user.phone_books.count
# phone_book = user.phone_books.first
@@ -34,9 +34,9 @@ class PhoneBookTest < ActiveSupport::TestCase
# # Lets test some stuff about the phone_book_entries
# assert_equal 0, phone_book.phone_book_entries.count
- # entry1 = Factory.create(:phone_book_entry, :phone_book_id => phone_book.id)
- # entry2 = Factory.create(:phone_book_entry, :phone_book_id => phone_book.id)
- # entry3 = Factory.create(:phone_book_entry, :phone_book_id => phone_book.id)
+ # entry1 = FactoryGirl.create(:phone_book_entry, :phone_book_id => phone_book.id)
+ # entry2 = FactoryGirl.create(:phone_book_entry, :phone_book_id => phone_book.id)
+ # entry3 = FactoryGirl.create(:phone_book_entry, :phone_book_id => phone_book.id)
# assert_equal 3, phone_book.phone_book_entries.count
# assert_equal 1, PhoneBookEntry.where(:id => entry1.id).count
@@ -50,22 +50,22 @@ class PhoneBookTest < ActiveSupport::TestCase
# end
test "Tenant gets automatically one phone book and can destroy it" do
- tenant = Factory.create(:tenant)
+ tenant = FactoryGirl.create(:tenant)
assert_equal 1, tenant.phone_books.count
tenant.phone_books.first.destroy
assert_equal 0, tenant.phone_books.count
end
# test "only tenant members can read a tenant phone book" do
- # tenant = Factory.create(:tenant)
- # user = Factory.create(:user)
+ # tenant = FactoryGirl.create(:tenant)
+ # user = FactoryGirl.create(:user)
# tenant.users << user
# tenant.save
# user.current_tenant = tenant
# user.save
- # phone_book = Factory.create(:phone_book, :phone_bookable_type => 'Tenant', :phone_bookable_id => tenant.id)
+ # phone_book = FactoryGirl.create(:phone_book, :phone_bookable_type => 'Tenant', :phone_bookable_id => tenant.id)
- # evil_user = Factory.create(:user)
+ # evil_user = FactoryGirl.create(:user)
# user_ability = Ability.new( user )
# evil_user_ability = Ability.new( evil_user )
@@ -79,12 +79,12 @@ class PhoneBookTest < ActiveSupport::TestCase
# test "tenant's phone book can not be edited by tenant members" do
- # tenant = Factory.create(:tenant)
- # user = Factory.create(:user)
+ # tenant = FactoryGirl.create(:tenant)
+ # user = FactoryGirl.create(:user)
# tenant.users << user
- # phone_book = Factory.create(:phone_book, :phone_bookable_type => 'Tenant', :phone_bookable_id => tenant.id)
+ # phone_book = FactoryGirl.create(:phone_book, :phone_bookable_type => 'Tenant', :phone_bookable_id => tenant.id)
- # evil_user = Factory.create(:user)
+ # evil_user = FactoryGirl.create(:user)
# user_ability = Ability.new( user )
# evil_user_ability = Ability.new( evil_user )
@@ -96,10 +96,10 @@ class PhoneBookTest < ActiveSupport::TestCase
# end
# test "only user can manage his private phone book after creating it" do
- # user = Factory.create(:user)
- # phone_book = Factory.create(:phone_book, :phone_bookable_type => 'User', :phone_bookable_id => user.id)
+ # user = FactoryGirl.create(:user)
+ # phone_book = FactoryGirl.create(:phone_book, :phone_bookable_type => 'User', :phone_bookable_id => user.id)
- # evil_user = Factory.create(:user)
+ # evil_user = FactoryGirl.create(:user)
# user_ability = Ability.new( user )
# evil_user_ability = Ability.new( evil_user )
@@ -111,7 +111,7 @@ class PhoneBookTest < ActiveSupport::TestCase
# end
def test_that_the_initial_state_should_be_active
- @phone_book = Factory.create(:phone_book)
+ @phone_book = FactoryGirl.create(:phone_book)
assert_equal 'active', @phone_book.state
assert @phone_book.active?
end