summaryrefslogtreecommitdiff
path: root/test/unit/phone_book_test.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-22 15:33:06 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-22 15:33:06 +0100
commit39aa7132ceed3d4beab3a9b828e571bbfc67c07e (patch)
tree6c88289c9f99be0af8635636fcdf64102090e5ec /test/unit/phone_book_test.rb
parent5ad8203ce4f1bfea997960d0b52c626dea24b944 (diff)
parent6f69c1a85055ec7c2515719d79d2a7a4e60cec50 (diff)
Merge branch 'develop'5.1-beta1
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