summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/area_code_test.rb2
-rw-r--r--test/unit/call_forward_test.rb2
-rw-r--r--test/unit/conference_invitee_test.rb4
-rw-r--r--test/unit/conference_test.rb16
-rw-r--r--test/unit/country_test.rb2
-rw-r--r--test/unit/gemeinschaft_setup_test.rb2
-rw-r--r--test/unit/language_test.rb2
-rw-r--r--test/unit/manufacturer_test.rb6
-rw-r--r--test/unit/oui_test.rb4
-rw-r--r--test/unit/phone_book_entry_test.rb22
-rw-r--r--test/unit/phone_book_test.rb44
-rw-r--r--test/unit/phone_model_test.rb2
-rw-r--r--test/unit/phone_number_range_test.rb2
-rw-r--r--test/unit/phone_number_test.rb20
-rw-r--r--test/unit/phone_test.rb14
-rw-r--r--test/unit/sip_account_test.rb10
-rw-r--r--test/unit/sip_domain_test.rb2
-rw-r--r--test/unit/tenant_membership_test.rb4
-rw-r--r--test/unit/tenant_test.rb12
-rw-r--r--test/unit/user_group_membership_test.rb20
-rw-r--r--test/unit/user_group_test.rb20
-rw-r--r--test/unit/user_test.rb24
22 files changed, 118 insertions, 118 deletions
diff --git a/test/unit/area_code_test.rb b/test/unit/area_code_test.rb
index 10c7c08..d59b290 100644
--- a/test/unit/area_code_test.rb
+++ b/test/unit/area_code_test.rb
@@ -2,6 +2,6 @@ require 'test_helper'
class AreaCodeTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:area_code).valid?
+ assert FactoryGirl.build(:area_code).valid?
end
end
diff --git a/test/unit/call_forward_test.rb b/test/unit/call_forward_test.rb
index 95716c5..afde3c0 100644
--- a/test/unit/call_forward_test.rb
+++ b/test/unit/call_forward_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class CallForwardTest < ActiveSupport::TestCase
test "should have a valid factory" do
- assert Factory.build(:call_forward).valid?
+ assert FactoryGirl.build(:call_forward).valid?
end
end
diff --git a/test/unit/conference_invitee_test.rb b/test/unit/conference_invitee_test.rb
index bcc4c9b..2823709 100644
--- a/test/unit/conference_invitee_test.rb
+++ b/test/unit/conference_invitee_test.rb
@@ -3,11 +3,11 @@ require 'test_helper'
class ConferenceInviteeTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:conference_invitee).valid?
+ assert FactoryGirl.build(:conference_invitee).valid?
end
test "parent conference should not have a phone number twice" do
- invitee = Factory.create(:conference_invitee)
+ invitee = FactoryGirl.create(:conference_invitee)
conference = invitee.conference
phone_number = PhoneNumber.new(:number => invitee.phone_number.number)
invitee_bad = conference.conference_invitees.build(:phone_number => phone_number)
diff --git a/test/unit/conference_test.rb b/test/unit/conference_test.rb
index b7cce28..85f7ddb 100644
--- a/test/unit/conference_test.rb
+++ b/test/unit/conference_test.rb
@@ -3,29 +3,29 @@ require 'test_helper'
class ConferenceTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:conference).valid?
+ assert FactoryGirl.build(:conference).valid?
end
def test_dates_must_make_sense
# We can't create a conference in the past.
- assert !Factory.build(:conference, :start => Time.now - 1.day, :end => Time.now + 1.day).valid?
+ assert !FactoryGirl.build(:conference, :start => Time.now - 1.day, :end => Time.now + 1.day).valid?
# But we can create a conference which started 2 minutes ago.
- assert Factory.build(:conference, :start => Time.now - 2.minutes, :end => Time.now + 1.hour).valid?
+ assert FactoryGirl.build(:conference, :start => Time.now - 2.minutes, :end => Time.now + 1.hour).valid?
# The end must be before the start.
- assert !Factory.build(:conference, :start => Time.now + 2.day, :end => Time.now + 1.day).valid?
+ assert !FactoryGirl.build(:conference, :start => Time.now + 2.day, :end => Time.now + 1.day).valid?
# No date at all is fine.
- assert Factory.build(:conference, :start => nil, :end => nil).valid?
+ assert FactoryGirl.build(:conference, :start => nil, :end => nil).valid?
# Just start or just end is not ok.
- assert !Factory.build(:conference, :start => nil, :end => Time.now + 1.day).valid?
- assert !Factory.build(:conference, :start => Time.now + 1.day, :end => nil).valid?
+ assert !FactoryGirl.build(:conference, :start => nil, :end => Time.now + 1.day).valid?
+ assert !FactoryGirl.build(:conference, :start => Time.now + 1.day, :end => nil).valid?
end
def test_pin_must_be_nil_or_more_than_6_digits
- conference = Factory.build(:conference, :pin => nil)
+ conference = FactoryGirl.build(:conference, :pin => nil)
assert conference.valid?
diff --git a/test/unit/country_test.rb b/test/unit/country_test.rb
index 4933843..06f520e 100644
--- a/test/unit/country_test.rb
+++ b/test/unit/country_test.rb
@@ -2,6 +2,6 @@ require 'test_helper'
class CountryTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:country).valid?
+ assert FactoryGirl.build(:country).valid?
end
end
diff --git a/test/unit/gemeinschaft_setup_test.rb b/test/unit/gemeinschaft_setup_test.rb
index 5ea6523..bd398ff 100644
--- a/test/unit/gemeinschaft_setup_test.rb
+++ b/test/unit/gemeinschaft_setup_test.rb
@@ -2,6 +2,6 @@ require 'test_helper'
class GemeinschaftSetupTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:gemeinschaft_setup).valid?
+ assert FactoryGirl.build(:gemeinschaft_setup).valid?
end
end
diff --git a/test/unit/language_test.rb b/test/unit/language_test.rb
index 3308735..4a8cd77 100644
--- a/test/unit/language_test.rb
+++ b/test/unit/language_test.rb
@@ -2,6 +2,6 @@ require 'test_helper'
class LanguageTest < ActiveSupport::TestCase
test "has a valid factory" do
- assert Factory.build(:language).valid?
+ assert FactoryGirl.build(:language).valid?
end
end
diff --git a/test/unit/manufacturer_test.rb b/test/unit/manufacturer_test.rb
index 635a977..012d34d 100644
--- a/test/unit/manufacturer_test.rb
+++ b/test/unit/manufacturer_test.rb
@@ -2,18 +2,18 @@ require 'test_helper'
class ManufacturerTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:manufacturer).valid?
+ assert FactoryGirl.build(:manufacturer).valid?
end
# StateMachine Tests:
def test_that_the_initial_state_should_be_active
- @manufacturer = Factory.create(:manufacturer)
+ @manufacturer = FactoryGirl.create(:manufacturer)
assert_equal 'active', @manufacturer.state
assert @manufacturer.active?
end
def test_not_active_state_will_not_be_displayed
- @manufacturer = Factory.create(:manufacturer)
+ @manufacturer = FactoryGirl.create(:manufacturer)
assert_equal 1, Manufacturer.count
@manufacturer.deactivate!
diff --git a/test/unit/oui_test.rb b/test/unit/oui_test.rb
index de48a97..cff5864 100644
--- a/test/unit/oui_test.rb
+++ b/test/unit/oui_test.rb
@@ -2,11 +2,11 @@ require 'test_helper'
class OuiTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:oui).valid?
+ assert FactoryGirl.build(:oui).valid?
end
def test_that_the_initial_state_should_be_active
- @oui = Factory.create(:oui)
+ @oui = FactoryGirl.create(:oui)
assert_equal 'active', @oui.state
assert @oui.active?
end
diff --git a/test/unit/phone_book_entry_test.rb b/test/unit/phone_book_entry_test.rb
index c8d639b..2613398 100644
--- a/test/unit/phone_book_entry_test.rb
+++ b/test/unit/phone_book_entry_test.rb
@@ -2,17 +2,17 @@ require 'test_helper'
class PhoneBookEntryTest < ActiveSupport::TestCase
def test_should_be_valid
- assert Factory.build(:phone_book_entry).valid?
+ assert FactoryGirl.build(:phone_book_entry).valid?
end
# TODO Fix this test.
# test "only user can read entries in private phone books" do
- # user = Factory.create(:user)
- # phone_book = Factory.create(:phone_book, :phone_bookable_type => 'User', :phone_bookable_id => user.id)
- # phone_book_entry = Factory.create(:phone_book_entry, :phone_book_id => phone_book.id)
+ # user = FactoryGirl.create(:user)
+ # phone_book = FactoryGirl.create(:phone_book, :phone_bookable_type => 'User', :phone_bookable_id => user.id)
+ # phone_book_entry = FactoryGirl.create(:phone_book_entry, :phone_book_id => phone_book.id)
- # evil_user = Factory.create(:user)
+ # evil_user = FactoryGirl.create(:user)
# user_ability = Ability.new( user )
# evil_user_ability = Ability.new( evil_user )
@@ -24,17 +24,17 @@ class PhoneBookEntryTest < ActiveSupport::TestCase
# end
def test_that_the_initial_state_should_be_active
- @phone_book_entry = Factory.create(:phone_book_entry)
+ @phone_book_entry = FactoryGirl.create(:phone_book_entry)
assert_equal 'active', @phone_book_entry.state
assert @phone_book_entry.active?
end
test "a destroyed phone_book will destroy all phone_book_entries" do
- phone_book = Factory.create(:phone_book)
- 10.times { Factory.create(:phone_book_entry, :phone_book_id => phone_book.id) }
+ phone_book = FactoryGirl.create(:phone_book)
+ 10.times { FactoryGirl.create(:phone_book_entry, :phone_book_id => phone_book.id) }
- phone_book2 = Factory.create(:phone_book)
- 5.times { Factory.create(:phone_book_entry, :phone_book_id => phone_book2.id) }
+ phone_book2 = FactoryGirl.create(:phone_book)
+ 5.times { FactoryGirl.create(:phone_book_entry, :phone_book_id => phone_book2.id) }
assert_equal 15, PhoneBookEntry.all.count
@@ -44,7 +44,7 @@ class PhoneBookEntryTest < ActiveSupport::TestCase
end
test "that the value_of_to_s field is filled" do
- phone_book_entry = Factory.create(:phone_book_entry)
+ phone_book_entry = FactoryGirl.create(:phone_book_entry)
assert_equal phone_book_entry.value_of_to_s, phone_book_entry.to_s
end
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
diff --git a/test/unit/phone_model_test.rb b/test/unit/phone_model_test.rb
index e358cf9..ef293f4 100644
--- a/test/unit/phone_model_test.rb
+++ b/test/unit/phone_model_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class PhoneModelTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:phone_model).valid?
+ assert FactoryGirl.build(:phone_model).valid?
end
end
diff --git a/test/unit/phone_number_range_test.rb b/test/unit/phone_number_range_test.rb
index 1770299..e70cd60 100644
--- a/test/unit/phone_number_range_test.rb
+++ b/test/unit/phone_number_range_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class PhoneNumberRangeTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:phone_number_range).valid?
+ assert FactoryGirl.build(:phone_number_range).valid?
end
end
diff --git a/test/unit/phone_number_test.rb b/test/unit/phone_number_test.rb
index e10b20c..3fd92d6 100644
--- a/test/unit/phone_number_test.rb
+++ b/test/unit/phone_number_test.rb
@@ -5,17 +5,17 @@ require 'test_helper'
class PhoneNumberTest < ActiveSupport::TestCase
test "should have valid factory" do
- assert Factory.build(:phone_number).valid?
+ assert FactoryGirl.build(:phone_number).valid?
end
def test_that_the_initial_state_should_be_active
- @phone_number = Factory.create(:phone_number)
+ @phone_number = FactoryGirl.create(:phone_number)
assert_equal 'active', @phone_number.state
assert @phone_number.active?
end
test "that the value_of_to_s field is filled" do
- phone_number = Factory.create(:phone_number)
+ phone_number = FactoryGirl.create(:phone_number)
assert_equal phone_number.value_of_to_s, phone_number.to_s
end
@@ -198,7 +198,7 @@ class PhoneNumberTest < ActiveSupport::TestCase
AreaCode.create(:country => germany, :name => "Hohenmocker", :area_code => "39993")
# create a tenant
- tenant = Factory.create(:tenant, :country_id => germany.id)
+ tenant = FactoryGirl.create(:tenant, :country_id => germany.id)
# create some extensions
internal_extension_range = tenant.phone_number_ranges.create(:name => INTERNAL_EXTENSIONS)
['2000', '2001', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '5', '99'].each do |extension|
@@ -216,7 +216,7 @@ class PhoneNumberTest < ActiveSupport::TestCase
# Language.create(:name => 'Deutsch', :code => 'de')
# AreaCode.create(:country => germany, :name => "Bendorf", :area_code => "2622")
- # @sip_domain = Factory.create(:sip_domain)
+ # @sip_domain = FactoryGirl.create(:sip_domain)
# @tenant = @sip_domain.tenants.build(:name => 'AMOOMA GmbH')
# @tenant.country = Country.first
@@ -226,8 +226,8 @@ class PhoneNumberTest < ActiveSupport::TestCase
# @tenant.generate_internal_extensions
- # sip_account = @tenant.sip_accounts.build(Factory.create(:sip_account).attributes)
- # phone_number = sip_account.phone_numbers.create(Factory.build(:phone_number, :number => '10').attributes)
+ # sip_account = @tenant.sip_accounts.build(FactoryGirl.create(:sip_account).attributes)
+ # phone_number = sip_account.phone_numbers.create(FactoryGirl.build(:phone_number, :number => '10').attributes)
# phone_number_evil = sip_account.phone_numbers.build(phone_number.attributes)
# assert phone_number.valid?
@@ -235,14 +235,14 @@ class PhoneNumberTest < ActiveSupport::TestCase
# end
# test "has to be unique per SIP domain even for different tenants" do
- # provider_sip_domain = Factory.create(:sip_domain)
+ # provider_sip_domain = FactoryGirl.create(:sip_domain)
# tenants = []
# sip_accounts = []
# 2.times { |i|
- # tenants[i] = provider_sip_domain.tenants.create(Factory.build(:tenant, :internal_extension_ranges => '10-20').attributes)
+ # tenants[i] = provider_sip_domain.tenants.create(FactoryGirl.build(:tenant, :internal_extension_ranges => '10-20').attributes)
# tenants[i].generate_internal_extensions
- # sip_accounts[i] = tenants[i].sip_accounts.build(Factory.build(:sip_account, :tenant_id => tenants[i].id).attributes)
+ # sip_accounts[i] = tenants[i].sip_accounts.build(FactoryGirl.build(:sip_account, :tenant_id => tenants[i].id).attributes)
# sip_accounts[i].phone_numbers.build(:number => '10')
# }
# sip_accounts[0].save
diff --git a/test/unit/phone_test.rb b/test/unit/phone_test.rb
index 4ad21df..b9d33af 100644
--- a/test/unit/phone_test.rb
+++ b/test/unit/phone_test.rb
@@ -3,19 +3,19 @@ require 'test_helper'
class PhoneTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:phone).valid?
+ assert FactoryGirl.build(:phone).valid?
end
# test "should destroy_all phones_sip_accounts if the phoneable changed" do
- # sip_domain = Factory.create(:sip_domain)
- # tenant = sip_domain.tenants.create(Factory.build(:tenant).attributes)
+ # sip_domain = FactoryGirl.create(:sip_domain)
+ # tenant = sip_domain.tenants.create(FactoryGirl.build(:tenant).attributes)
#
- # user1 = Factory.create(:user)
- # user2 = Factory.create(:user)
+ # user1 = FactoryGirl.create(:user)
+ # user2 = FactoryGirl.create(:user)
# tenant.tenant_memberships.create(:user_id => user1.id)
# tenant.tenant_memberships.create(:user_id => user2.id)
#
- # phone = Factory.create(:phone, :phoneable => tenant)
+ # phone = FactoryGirl.create(:phone, :phoneable => tenant)
#
# # Nothing there
# #
@@ -28,7 +28,7 @@ class PhoneTest < ActiveSupport::TestCase
#
# # create some sip_accounts associated to phone
# #
- # 3.times { Factory.create(:sip_account, :sip_accountable => user1, :tenant_id => tenant.id) }
+ # 3.times { FactoryGirl.create(:sip_account, :sip_accountable => user1, :tenant_id => tenant.id) }
# SipAccount.all.each do |sip_account|
# phone.phones_sip_accounts.create(:sip_account_id => sip_account.id)
# end
diff --git a/test/unit/sip_account_test.rb b/test/unit/sip_account_test.rb
index 6595ccc..e85e493 100644
--- a/test/unit/sip_account_test.rb
+++ b/test/unit/sip_account_test.rb
@@ -3,21 +3,21 @@ require 'test_helper'
class SipAccountTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:sip_account).valid?
+ assert FactoryGirl.build(:sip_account).valid?
end
test "that the value_of_to_s field is filled" do
- sip_account = Factory.create(:sip_account)
+ sip_account = FactoryGirl.create(:sip_account)
assert_equal sip_account.value_of_to_s, sip_account.to_s
end
test "should have a unique auth_name per sip_domain" do
- provider_sip_domain = Factory.create(:sip_domain)
+ provider_sip_domain = FactoryGirl.create(:sip_domain)
tenants = []
sip_accounts = []
2.times { |i|
- tenants[i] = provider_sip_domain.tenants.create(Factory.build(:tenant).attributes)
- sip_accounts[i] = Factory.build(
+ tenants[i] = provider_sip_domain.tenants.create(FactoryGirl.build(:tenant).attributes)
+ sip_accounts[i] = FactoryGirl.build(
:sip_account,
:sip_accountable => tenants[i],
:auth_name => "somerandomauthname",
diff --git a/test/unit/sip_domain_test.rb b/test/unit/sip_domain_test.rb
index 5d31f69..61ac89a 100644
--- a/test/unit/sip_domain_test.rb
+++ b/test/unit/sip_domain_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class SipDomainTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:sip_domain).valid?
+ assert FactoryGirl.build(:sip_domain).valid?
end
end
diff --git a/test/unit/tenant_membership_test.rb b/test/unit/tenant_membership_test.rb
index 8e7a191..ba57eae 100644
--- a/test/unit/tenant_membership_test.rb
+++ b/test/unit/tenant_membership_test.rb
@@ -2,11 +2,11 @@ require 'test_helper'
class TenantMembershipTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:tenant_membership).valid?
+ assert FactoryGirl.build(:tenant_membership).valid?
end
def test_that_the_initial_state_should_be_active
- @tenant_membership = Factory.create(:tenant_membership)
+ @tenant_membership = FactoryGirl.create(:tenant_membership)
assert_equal 'active', @tenant_membership.state
assert @tenant_membership.active?
end
diff --git a/test/unit/tenant_test.rb b/test/unit/tenant_test.rb
index 4d4abce..0b342ba 100644
--- a/test/unit/tenant_test.rb
+++ b/test/unit/tenant_test.rb
@@ -2,23 +2,23 @@ require 'test_helper'
class TenantTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:tenant).valid?
+ assert FactoryGirl.build(:tenant).valid?
end
def test_should_have_unique_name
- tenant = Factory.create(:tenant)
- assert !Factory.build(:tenant, :name => tenant.name).valid?
- assert Factory.build(:tenant, :name => "different_#{tenant.name}").valid?
+ tenant = FactoryGirl.create(:tenant)
+ assert !FactoryGirl.build(:tenant, :name => tenant.name).valid?
+ assert FactoryGirl.build(:tenant, :name => "different_#{tenant.name}").valid?
end
def test_that_the_initial_state_should_be_active
- @tenant = Factory.create(:tenant)
+ @tenant = FactoryGirl.create(:tenant)
assert_equal 'active', @tenant.state
assert @tenant.active?
end
def test_not_active_state_will_not_be_displayed
- @tenant = Factory.create(:tenant)
+ @tenant = FactoryGirl.create(:tenant)
assert_equal 1, Tenant.count
@tenant.deactivate!
diff --git a/test/unit/user_group_membership_test.rb b/test/unit/user_group_membership_test.rb
index 251229f..34a577c 100644
--- a/test/unit/user_group_membership_test.rb
+++ b/test/unit/user_group_membership_test.rb
@@ -2,29 +2,29 @@ require 'test_helper'
class UserGroupMembershipTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:user_group_membership).valid?
+ assert FactoryGirl.build(:user_group_membership).valid?
end
def test_should_have_unique_members_in_each_group
- group1 = Factory.create(:user_group)
- group2 = Factory.create(:user_group)
- user1 = Factory.create(:user)
- user2 = Factory.create(:user)
- member = Factory.create(
+ group1 = FactoryGirl.create(:user_group)
+ group2 = FactoryGirl.create(:user_group)
+ user1 = FactoryGirl.create(:user)
+ user2 = FactoryGirl.create(:user)
+ member = FactoryGirl.create(
:user_group_membership,
:user_id => user1.id,
:user_group_id => group1.id
)
- assert !Factory.build(
+ assert !FactoryGirl.build(
:user_group_membership,
:user_id => user1.id,
:user_group_id => group1.id
).valid?
- assert Factory.build(
+ assert FactoryGirl.build(
:user_group_membership,
:user_id => user1.id,
:user_group_id => group2.id
).valid?
- assert Factory.build(
+ assert FactoryGirl.build(
:user_group_membership,
:user_id => user2.id,
:user_group_id => group1.id
@@ -32,7 +32,7 @@ class UserGroupMembershipTest < ActiveSupport::TestCase
end
def test_that_the_initial_state_should_be_active
- @user_group_membership = Factory.create(:user_group_membership)
+ @user_group_membership = FactoryGirl.create(:user_group_membership)
assert_equal 'active', @user_group_membership.state
assert @user_group_membership.active?
end
diff --git a/test/unit/user_group_test.rb b/test/unit/user_group_test.rb
index 5e815a8..1023bd6 100644
--- a/test/unit/user_group_test.rb
+++ b/test/unit/user_group_test.rb
@@ -2,23 +2,23 @@ require 'test_helper'
class UserGroupTest < ActiveSupport::TestCase
def test_should_have_a_valid_factory
- assert Factory.build(:user_group).valid?
+ assert FactoryGirl.build(:user_group).valid?
end
def test_should_have_unique_name_on_same_tenant
- tenant1 = Factory.create(:tenant)
- tenant2 = Factory.create(:tenant)
- group = Factory.create(:user_group, :tenant_id => tenant1.id)
- assert !Factory.build(:user_group, :name => group.name, :tenant_id => tenant1.id).valid?
- assert Factory.build(:user_group, :name => group.name, :tenant_id => tenant2.id).valid?
- assert Factory.build(:user_group, :name => "different_#{group.name}", :tenant_id => tenant1.id).valid?
+ tenant1 = FactoryGirl.create(:tenant)
+ tenant2 = FactoryGirl.create(:tenant)
+ group = FactoryGirl.create(:user_group, :tenant_id => tenant1.id)
+ assert !FactoryGirl.build(:user_group, :name => group.name, :tenant_id => tenant1.id).valid?
+ assert FactoryGirl.build(:user_group, :name => group.name, :tenant_id => tenant2.id).valid?
+ assert FactoryGirl.build(:user_group, :name => "different_#{group.name}", :tenant_id => tenant1.id).valid?
end
test "user_group_membership only available for tenant_memberships" do
- good_tenant = Factory.create(:tenant)
- evil_tenant = Factory.create(:tenant)
+ good_tenant = FactoryGirl.create(:tenant)
+ evil_tenant = FactoryGirl.create(:tenant)
- user = Factory.create(:user)
+ user = FactoryGirl.create(:user)
good_tenant.tenant_memberships.create(:user_id => user.id)
good_user_group = good_tenant.user_groups.create(:name => 'Example')
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