summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-30 22:17:32 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-30 22:17:32 +0100
commitaf79440bd75d2cffb2eb0ba43b5cfe918a78162c (patch)
treefd6c4dab5dc56fed5f616ddec20e1f82780f20fe /test
parent648f51a0ac97675d6cdf6a4b0c3c75bc9ea23168 (diff)
parent9f14a9a6573db607b79124524088803812454515 (diff)
Merge branch 'rename_factory_class' into develop
Conflicts: Gemfile.lock
Diffstat (limited to 'test')
-rw-r--r--test/factories/area_codes.rb10
-rw-r--r--test/factories/call_forwards.rb28
-rw-r--r--test/factories/conference_invitees.rb12
-rw-r--r--test/factories/conferences.rb12
-rw-r--r--test/factories/countries.rb12
-rw-r--r--test/factories/gemeinschaft_setups.rb12
-rw-r--r--test/factories/languages.rb8
-rw-r--r--test/factories/manufacturers.rb8
-rw-r--r--test/factories/ouis.rb8
-rw-r--r--test/factories/phone_book_entries.rb10
-rw-r--r--test/factories/phone_books.rb8
-rw-r--r--test/factories/phone_models.rb8
-rw-r--r--test/factories/phone_number_ranges.rb8
-rw-r--r--test/factories/phone_numbers.rb10
-rw-r--r--test/factories/phones.rb22
-rw-r--r--test/factories/sip_accounts.rb26
-rw-r--r--test/factories/sip_domains.rb8
-rw-r--r--test/factories/tenant_memberships.rb8
-rw-r--r--test/factories/tenants.rb11
-rw-r--r--test/factories/user_group_memberships.rb22
-rw-r--r--test/factories/user_groups.rb8
-rw-r--r--test/factories/users.rb18
-rw-r--r--test/functional/call_forwards_controller_test.rb12
-rw-r--r--test/functional/conference_invitees_controller_test.rb2
-rw-r--r--test/functional/conferences_controller_test.rb2
-rw-r--r--test/functional/gemeinschaft_setups_controller_test.rb4
-rw-r--r--test/functional/manufacturers_controller_test.rb8
-rw-r--r--test/functional/page_controller_test.rb8
-rw-r--r--test/functional/phone_book_entries_controller_test.rb4
-rw-r--r--test/functional/phone_books_controller_test.rb10
-rw-r--r--test/functional/phone_models_controller_test.rb12
-rw-r--r--test/functional/phone_number_ranges_controller_test.rb2
-rw-r--r--test/functional/phone_numbers_controller_test.rb8
-rw-r--r--test/functional/phones_controller_test.rb4
-rw-r--r--test/functional/phones_sip_accounts_controller_test.rb2
-rw-r--r--test/functional/sip_accounts_controller_test.rb8
-rw-r--r--test/functional/sip_domains_controller_test.rb4
-rw-r--r--test/functional/tenants_controller_test.rb4
-rw-r--r--test/functional/user_groups_controller_test.rb4
-rw-r--r--test/functional/users_controller_test.rb6
-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
62 files changed, 330 insertions, 287 deletions
diff --git a/test/factories/area_codes.rb b/test/factories/area_codes.rb
index 87b2271..3ed894d 100644
--- a/test/factories/area_codes.rb
+++ b/test/factories/area_codes.rb
@@ -1,7 +1,9 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :area_code do |f|
- f.sequence(:name) { |n| "AreaCode #{n}" }
- f.sequence(:area_code) { |n| "#{n}" }
- f.association :country
+FactoryGirl.define do
+ factory :area_code do
+ sequence(:name) { |n| "AreaCode #{n}" }
+ sequence(:area_code) { |n| "#{n}" }
+ association :country
+ end
end \ No newline at end of file
diff --git a/test/factories/call_forwards.rb b/test/factories/call_forwards.rb
index d275e9d..bdb899e 100644
--- a/test/factories/call_forwards.rb
+++ b/test/factories/call_forwards.rb
@@ -1,16 +1,18 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :call_forward do |f|
- f.association :phone_number
- #OPTIMIZE Make sure that the phone_number's phone_numberable
- # isn't a phone_book_entry but a sip_account.
- #f.sequence( :call_forward_case_id ) { |n| CallForwardCase.where(:value => "always").first.id }
- #f.association :call_forward_case
- f.sequence( :call_forward_case_id ) { |n| 1 }
- f.sequence( :destination ) { |n| "20#{n}" }
- f.sequence( :to_voicemail ) { |n| false }
- f.sequence( :timeout ) { |n| nil }
- f.sequence( :source ) { |n| nil }
- f.sequence( :depth ) { |n| 5 }
- f.sequence( :active ) { |n| false }
+FactoryGirl.define do
+ factory :call_forward do
+ association :phone_number
+ #OPTIMIZE Make sure that the phone_number's phone_numberable
+ # isn't a phone_book_entry but a sip_account.
+ #f.sequence( :call_forward_case_id ) { |n| CallForwardCase.where(:value => "always").first.id }
+ #f.association :call_forward_case
+ sequence( :call_forward_case_id ) { |n| 1 }
+ sequence( :destination ) { |n| "20#{n}" }
+ sequence( :to_voicemail ) { |n| false }
+ sequence( :timeout ) { |n| nil }
+ sequence( :source ) { |n| nil }
+ sequence( :depth ) { |n| 5 }
+ sequence( :active ) { |n| false }
+ end
end
diff --git a/test/factories/conference_invitees.rb b/test/factories/conference_invitees.rb
index 4e1eb68..54fa53a 100644
--- a/test/factories/conference_invitees.rb
+++ b/test/factories/conference_invitees.rb
@@ -1,8 +1,10 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :conference_invitee do |f|
- f.phone_number { Factory.build(:phone_number) }
- f.association :conference
- f.speaker true
- f.moderator false
+FactoryGirl.define do
+ factory :conference_invitee do
+ phone_number { FactoryGirl.build(:phone_number) }
+ association :conference
+ speaker true
+ moderator false
+ end
end \ No newline at end of file
diff --git a/test/factories/conferences.rb b/test/factories/conferences.rb
index 3c49a7a..7a563b7 100644
--- a/test/factories/conferences.rb
+++ b/test/factories/conferences.rb
@@ -1,8 +1,10 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :conference do |f|
- f.sequence(:name) { |n| "Conference room #{n}" }
- f.open_for_anybody true
- f.association :conferenceable, :factory => :tenant
- f.max_members 10
+FactoryGirl.define do
+ factory :conference do
+ sequence(:name) { |n| "Conference room #{n}" }
+ open_for_anybody true
+ association :conferenceable, :factory => :tenant
+ max_members 10
+ end
end \ No newline at end of file
diff --git a/test/factories/countries.rb b/test/factories/countries.rb
index cc3fc88..99caab5 100644
--- a/test/factories/countries.rb
+++ b/test/factories/countries.rb
@@ -1,8 +1,10 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :country do |f|
- f.sequence(:name) { |n| "Country #{n}" }
- f.sequence(:country_code) { |n| "#{n}" }
- f.sequence(:international_call_prefix) { |n| "#{n}" }
- f.sequence(:trunk_prefix) { |n| "#{n}" }
+FactoryGirl.define do
+ factory :country do
+ sequence(:name) { |n| "Country #{n}" }
+ sequence(:country_code) { |n| "#{n}" }
+ sequence(:international_call_prefix) { |n| "#{n}" }
+ sequence(:trunk_prefix) { |n| "#{n}" }
+ end
end \ No newline at end of file
diff --git a/test/factories/gemeinschaft_setups.rb b/test/factories/gemeinschaft_setups.rb
index ed69bc3..a2c0f72 100644
--- a/test/factories/gemeinschaft_setups.rb
+++ b/test/factories/gemeinschaft_setups.rb
@@ -1,8 +1,10 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :gemeinschaft_setup do |f|
- f.association :user
- f.association :sip_domain
- f.association :country
- f.association :language
+FactoryGirl.define do
+ factory :gemeinschaft_setup do
+ association :user
+ association :sip_domain
+ association :country
+ association :language
+ end
end \ No newline at end of file
diff --git a/test/factories/languages.rb b/test/factories/languages.rb
index 29d2ece..a8ecace 100644
--- a/test/factories/languages.rb
+++ b/test/factories/languages.rb
@@ -1,6 +1,8 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :language do |f|
- f.name 'Deutsch'
- f.code 'de'
+FactoryGirl.define do
+ factory :language do
+ name 'Deutsch'
+ code 'de'
+ end
end \ No newline at end of file
diff --git a/test/factories/manufacturers.rb b/test/factories/manufacturers.rb
index f091dd2..e211fc6 100644
--- a/test/factories/manufacturers.rb
+++ b/test/factories/manufacturers.rb
@@ -1,6 +1,8 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :manufacturer do |f|
- f.sequence(:name) { |n| "#{n}. manufacturer" }
- f.sequence(:ieee_name) { |n| "#{n}. ieee" }
+FactoryGirl.define do
+ factory :manufacturer do
+ sequence(:name) { |n| "#{n}. manufacturer" }
+ sequence(:ieee_name) { |n| "#{n}. ieee" }
+ end
end \ No newline at end of file
diff --git a/test/factories/ouis.rb b/test/factories/ouis.rb
index 3a90fd4..f99f02b 100644
--- a/test/factories/ouis.rb
+++ b/test/factories/ouis.rb
@@ -1,6 +1,8 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :oui do |f|
- f.association :manufacturer
- f.sequence(:value) { |n| (n + 11184810).to_s(16).upcase }
+FactoryGirl.define do
+ factory :oui do
+ association :manufacturer
+ sequence(:value) { |n| (n + 11184810).to_s(16).upcase }
+ end
end \ No newline at end of file
diff --git a/test/factories/phone_book_entries.rb b/test/factories/phone_book_entries.rb
index 7427886..8e1b535 100644
--- a/test/factories/phone_book_entries.rb
+++ b/test/factories/phone_book_entries.rb
@@ -1,7 +1,9 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :phone_book_entry do |f|
- f.sequence(:last_name) { |n| "Lastname #{n}" }
- f.sequence(:is_male) { |n| true }
- f.association :phone_book
+FactoryGirl.define do
+ factory :phone_book_entry do
+ sequence(:last_name) { |n| "Lastname #{n}" }
+ sequence(:is_male) { |n| true }
+ association :phone_book
+ end
end
diff --git a/test/factories/phone_books.rb b/test/factories/phone_books.rb
index 4aa8d07..80e2a06 100644
--- a/test/factories/phone_books.rb
+++ b/test/factories/phone_books.rb
@@ -1,6 +1,8 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :phone_book do |f|
- f.sequence(:name) { |n| "Phone book #{n}" }
- f.association :phone_bookable, :factory => :user
+FactoryGirl.define do
+ factory :phone_book do
+ sequence(:name) { |n| "Phone book #{n}" }
+ association :phone_bookable, :factory => :user
+ end
end
diff --git a/test/factories/phone_models.rb b/test/factories/phone_models.rb
index 8e6a50f..28b8802 100644
--- a/test/factories/phone_models.rb
+++ b/test/factories/phone_models.rb
@@ -1,6 +1,8 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :phone_model do |f|
- f.sequence(:name) { |n| "Phone Model #{n}" }
- f.association :manufacturer
+FactoryGirl.define do
+ factory :phone_model do
+ sequence(:name) { |n| "Phone Model #{n}" }
+ association :manufacturer
+ end
end
diff --git a/test/factories/phone_number_ranges.rb b/test/factories/phone_number_ranges.rb
index cb2f7ee..68d9a03 100644
--- a/test/factories/phone_number_ranges.rb
+++ b/test/factories/phone_number_ranges.rb
@@ -1,6 +1,8 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :phone_number_range do |f|
- f.name INTERNAL_EXTENSIONS
- f.association :phone_number_rangeable, :factory => :tenant
+FactoryGirl.define do
+ factory :phone_number_range do
+ name INTERNAL_EXTENSIONS
+ association :phone_number_rangeable, :factory => :tenant
+ end
end
diff --git a/test/factories/phone_numbers.rb b/test/factories/phone_numbers.rb
index 74b43cc..3b25938 100644
--- a/test/factories/phone_numbers.rb
+++ b/test/factories/phone_numbers.rb
@@ -1,7 +1,9 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :phone_number do |f|
- f.sequence(:name) { |n| "Name #{n}" }
- f.sequence(:number) { |n| "(0)30 227 #{n}" }
- f.association :phone_numberable, :factory => :phone_book_entry
+FactoryGirl.define do
+ factory :phone_number do
+ sequence(:name) { |n| "Name #{n}" }
+ sequence(:number) { |n| "(0)30 227 #{n}" }
+ association :phone_numberable, :factory => :phone_book_entry
+ end
end \ No newline at end of file
diff --git a/test/factories/phones.rb b/test/factories/phones.rb
index 646d548..af0b37a 100644
--- a/test/factories/phones.rb
+++ b/test/factories/phones.rb
@@ -1,15 +1,17 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :phone do |f|
- f.sequence(:mac_address) { |n| ('%06d' % n).to_s + ('%06d' % n).to_s }
- f.association :phone_model
- f.association :phoneable, :factory => :tenant
+FactoryGirl.define do
+ factory :phone do |f|
+ f.sequence(:mac_address) { |n| ('%06d' % n).to_s + ('%06d' % n).to_s }
+ f.association :phone_model
+ f.association :phoneable, :factory => :tenant
- # We have to make sure that the OUI is created as well.
- f.after_build do |instance|
- Factory.create(:oui,
- :manufacturer => instance.phone_model.manufacturer,
- :value => instance.mac_address.slice(0, 6)
- )
+ # We have to make sure that the OUI is created as well.
+ f.after_build do |instance|
+ FactoryGirl.create(:oui,
+ :manufacturer => instance.phone_model.manufacturer,
+ :value => instance.mac_address.slice(0, 6)
+ )
+ end
end
end \ No newline at end of file
diff --git a/test/factories/sip_accounts.rb b/test/factories/sip_accounts.rb
index 2f91717..a21fa27 100644
--- a/test/factories/sip_accounts.rb
+++ b/test/factories/sip_accounts.rb
@@ -1,17 +1,19 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :sip_account do |f|
- f.association :sip_accountable, :factory => :user
- f.sequence(:auth_name) {|n| "auth_name#{n}" }
- f.sequence(:caller_name) {|n| "Foo Account #{n}" }
- f.sequence(:password) {|n| "12345678" }
-
- f.after_build do |sip_account|
- if sip_account.tenant_id.blank?
- tenant = sip_account.create_tenant(FactoryGirl.build(:tenant).attributes)
- sip_domain = tenant.create_sip_domain(FactoryGirl.build(:sip_domain).attributes)
- sip_account.tenant.tenant_memberships.create(:user_id => sip_account.sip_accountable.id)
- sip_account.tenant_id = tenant.id
+FactoryGirl.define do
+ factory :sip_account do |f|
+ f.association :sip_accountable, :factory => :user
+ f.sequence(:auth_name) {|n| "auth_name#{n}" }
+ f.sequence(:caller_name) {|n| "Foo Account #{n}" }
+ f.sequence(:password) {|n| "12345678" }
+
+ f.after_build do |sip_account|
+ if sip_account.tenant_id.blank?
+ tenant = sip_account.create_tenant(FactoryGirl.build(:tenant).attributes)
+ sip_domain = tenant.create_sip_domain(FactoryGirl.build(:sip_domain).attributes)
+ sip_account.tenant.tenant_memberships.create(:user_id => sip_account.sip_accountable.id)
+ sip_account.tenant_id = tenant.id
+ end
end
end
end
diff --git a/test/factories/sip_domains.rb b/test/factories/sip_domains.rb
index 347b6a6..442f270 100644
--- a/test/factories/sip_domains.rb
+++ b/test/factories/sip_domains.rb
@@ -1,6 +1,8 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :sip_domain do |f|
- f.sequence(:host ) {|n| "host#{n}.localdomain" }
- f.sequence(:realm ) {|n| "host#{n}.localdomain" }
+FactoryGirl.define do
+ factory :sip_domain do
+ sequence(:host ) {|n| "host#{n}.localdomain" }
+ sequence(:realm ) {|n| "host#{n}.localdomain" }
+ end
end
diff --git a/test/factories/tenant_memberships.rb b/test/factories/tenant_memberships.rb
index ee52367..38c4cb8 100644
--- a/test/factories/tenant_memberships.rb
+++ b/test/factories/tenant_memberships.rb
@@ -1,6 +1,8 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :tenant_membership do |f|
- f.association :user
- f.association :tenant
+FactoryGirl.define do
+ factory :tenant_membership do
+ association :user
+ association :tenant
+ end
end \ No newline at end of file
diff --git a/test/factories/tenants.rb b/test/factories/tenants.rb
index 9a62e93..fc85e88 100644
--- a/test/factories/tenants.rb
+++ b/test/factories/tenants.rb
@@ -1,8 +1,9 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :tenant do |f|
- f.sequence(:name) { |n| "Tenant #{n}" }
- f.association :country
- f.association :language
-# f.association :sip_domain
+FactoryGirl.define do
+ factory :tenant do
+ sequence(:name) { |n| "Tenant #{n}" }
+ association :country
+ association :language
+ end
end
diff --git a/test/factories/user_group_memberships.rb b/test/factories/user_group_memberships.rb
index 7904f2f..8dc74f0 100644
--- a/test/factories/user_group_memberships.rb
+++ b/test/factories/user_group_memberships.rb
@@ -1,14 +1,16 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :user_group_membership do |f|
- f.association :user_group
- f.association :user
-
- # Make sure that the User is a member of the Tenant.
- f.after_build do |instance|
- Factory.create(:tenant_membership,
- :tenant_id => instance.user_group.tenant.id,
- :user_id => instance.user.id
- )
+FactoryGirl.define do
+ factory :user_group_membership do |f|
+ f.association :user_group
+ f.association :user
+
+ # Make sure that the User is a member of the Tenant.
+ f.after_build do |instance|
+ FactoryGirl.create(:tenant_membership,
+ :tenant_id => instance.user_group.tenant.id,
+ :user_id => instance.user.id
+ )
+ end
end
end \ No newline at end of file
diff --git a/test/factories/user_groups.rb b/test/factories/user_groups.rb
index 9a448ec..c777d95 100644
--- a/test/factories/user_groups.rb
+++ b/test/factories/user_groups.rb
@@ -1,6 +1,8 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :user_group do |f|
- f.sequence(:name) { |n| "UserGroup #{n}" }
- f.association :tenant
+FactoryGirl.define do
+ factory :user_group do
+ sequence(:name) { |n| "UserGroup #{n}" }
+ association :tenant
+ end
end \ No newline at end of file
diff --git a/test/factories/users.rb b/test/factories/users.rb
index 3d53141..a84b41d 100644
--- a/test/factories/users.rb
+++ b/test/factories/users.rb
@@ -1,11 +1,13 @@
# Read about factories at http://github.com/thoughtbot/factory_girl
-Factory.define :user do |f|
- f.sequence(:user_name) { |n| "User #{n}" }
- f.sequence(:first_name) { |n| "John #{n}" }
- f.sequence(:last_name) { |n| "Smith #{n}" }
- f.sequence(:email) { |n| "john.smith#{n}@company.com" }
- f.sequence(:password) { |n| "Testpassword#{n}" }
- f.sequence(:password_confirmation) { |n| "Testpassword#{n}" }
- f.association :language
+FactoryGirl.define do
+ factory :user do
+ sequence(:user_name) { |n| "User #{n}" }
+ sequence(:first_name) { |n| "John #{n}" }
+ sequence(:last_name) { |n| "Smith #{n}" }
+ sequence(:email) { |n| "john.smith#{n}@company.com" }
+ sequence(:password) { |n| "Testpassword#{n}" }
+ sequence(:password_confirmation) { |n| "Testpassword#{n}" }
+ association :language
+ end
end \ No newline at end of file
diff --git a/test/functional/call_forwards_controller_test.rb b/test/functional/call_forwards_controller_test.rb
index 0993623..da8e6c9 100644
--- a/test/functional/call_forwards_controller_test.rb
+++ b/test/functional/call_forwards_controller_test.rb
@@ -3,27 +3,27 @@ require 'test_helper'
class CallForwardsControllerTest < ActionController::TestCase
setup do
- @user = Factory.create(:user)
+ @user = FactoryGirl.create(:user)
- #@tenant = Factory.create(:tenant)
+ #@tenant = FactoryGirl.create(:tenant)
#@tenant.tenant_memberships.create(:user_id => @user.id)
#@user.update_attributes!(:current_tenant_id => @tenant.id)
- @sip_account = Factory.create(
+ @sip_account = FactoryGirl.create(
:sip_account,
:sip_accountable => @user,
)
@user.sip_accounts << @sip_account
@sip_account = @user.sip_accounts.last
- @phone_number = Factory.create(
+ @phone_number = FactoryGirl.create(
:phone_number,
:phone_numberable => @sip_account,
)
@sip_account.phone_numbers << @phone_number
@phone_number = @sip_account.phone_numbers.last
- @call_forward = Factory.create(
+ @call_forward = FactoryGirl.create(
:call_forward,
:phone_number => @phone_number,
)
@@ -50,7 +50,7 @@ class CallForwardsControllerTest < ActionController::TestCase
# assert_difference('CallForward.count') do
# post :create,
# :phone_number_id => @phone_number.to_param,
-# :call_forward => Factory.attributes_for(
+# :call_forward => FactoryGirl.attributes_for(
# :call_forward
# )
# end
diff --git a/test/functional/conference_invitees_controller_test.rb b/test/functional/conference_invitees_controller_test.rb
index 72d2e2c..8ac5479 100644
--- a/test/functional/conference_invitees_controller_test.rb
+++ b/test/functional/conference_invitees_controller_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class ConferenceInviteesControllerTest < ActionController::TestCase
setup do
- @conference_invitee = Factory.create(:conference_invitee)
+ @conference_invitee = FactoryGirl.create(:conference_invitee)
end
# test "should get index" do
diff --git a/test/functional/conferences_controller_test.rb b/test/functional/conferences_controller_test.rb
index 954838b..0f2d007 100644
--- a/test/functional/conferences_controller_test.rb
+++ b/test/functional/conferences_controller_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class ConferencesControllerTest < ActionController::TestCase
setup do
- @conference = Factory.create(:conference)
+ @conference = FactoryGirl.create(:conference)
end
# test "should get index" do
diff --git a/test/functional/gemeinschaft_setups_controller_test.rb b/test/functional/gemeinschaft_setups_controller_test.rb
index b23a878..5e6cadf 100644
--- a/test/functional/gemeinschaft_setups_controller_test.rb
+++ b/test/functional/gemeinschaft_setups_controller_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class GemeinschaftSetupsControllerTest < ActionController::TestCase
setup do
- @gemeinschaft_setup = Factory.build(:gemeinschaft_setup)
+ @gemeinschaft_setup = FactoryGirl.build(:gemeinschaft_setup)
end
# test "should get index" do
@@ -20,7 +20,7 @@ class GemeinschaftSetupsControllerTest < ActionController::TestCase
# test "should create gemeinschaft_setup" do
# assert_difference('GemeinschaftSetup.count') do
# post :create,
-# gemeinschaft_setup: Factory.attributes_for(:gemeinschaft_setup)
+# gemeinschaft_setup: FactoryGirl.attributes_for(:gemeinschaft_setup)
# end
# assert_redirected_to gemeinschaft_setup_path(assigns(:gemeinschaft_setup))
# end
diff --git a/test/functional/manufacturers_controller_test.rb b/test/functional/manufacturers_controller_test.rb
index dad38e5..0b10f6d 100644
--- a/test/functional/manufacturers_controller_test.rb
+++ b/test/functional/manufacturers_controller_test.rb
@@ -2,14 +2,14 @@ require 'test_helper'
class ManufacturersControllerTest < ActionController::TestCase
setup do
- @tenant = Factory.create(:tenant)
- @user = Factory.create(:user)
+ @tenant = FactoryGirl.create(:tenant)
+ @user = FactoryGirl.create(:user)
@tenant.tenant_memberships.create(:user_id => @user.id)
@user.update_attributes!(:current_tenant_id => @tenant.id)
- @manufacturer = Factory.create(:manufacturer)
+ @manufacturer = FactoryGirl.create(:manufacturer)
@expected_status_if_not_authorized = :redirect
end
@@ -46,7 +46,7 @@ class ManufacturersControllerTest < ActionController::TestCase
#
# test "should create manufacturer" do
# assert_difference('Manufacturer.count') do
- # post :create, manufacturer: Factory.build(:manufacturer).attributes
+ # post :create, manufacturer: FactoryGirl.build(:manufacturer).attributes
# end
#
# assert_redirected_to manufacturer_path(assigns(:manufacturer))
diff --git a/test/functional/page_controller_test.rb b/test/functional/page_controller_test.rb
index a5ae5ad..2bc1b80 100644
--- a/test/functional/page_controller_test.rb
+++ b/test/functional/page_controller_test.rb
@@ -11,8 +11,8 @@ class PageControllerTest < ActionController::TestCase
test "a logged in user should get index" do
- @tenant = Factory.create(:tenant)
- @user = Factory.create(:user)
+ @tenant = FactoryGirl.create(:tenant)
+ @user = FactoryGirl.create(:user)
@tenant.users << @user
@@ -22,8 +22,8 @@ class PageControllerTest < ActionController::TestCase
end
test "a logged out user should be redirected to the login" do
- @tenant = Factory.create(:tenant)
- @user = Factory.create(:user)
+ @tenant = FactoryGirl.create(:tenant)
+ @user = FactoryGirl.create(:user)
@tenant.users << @user
diff --git a/test/functional/phone_book_entries_controller_test.rb b/test/functional/phone_book_entries_controller_test.rb
index 81c5b61..b340f0f 100644
--- a/test/functional/phone_book_entries_controller_test.rb
+++ b/test/functional/phone_book_entries_controller_test.rb
@@ -3,9 +3,9 @@ require 'test_helper'
class PhoneBookEntriesControllerTest < ActionController::TestCase
setup do
- @user1 = Factory.create(:user)
+ @user1 = FactoryGirl.create(:user)
pb = @user1.phone_books.first
- @user1_phone_book_entry = Factory.create(
+ @user1_phone_book_entry = FactoryGirl.create(
:phone_book_entry,
:phone_book_id => pb.id
)
diff --git a/test/functional/phone_books_controller_test.rb b/test/functional/phone_books_controller_test.rb
index a00f597..aef2890 100644
--- a/test/functional/phone_books_controller_test.rb
+++ b/test/functional/phone_books_controller_test.rb
@@ -2,19 +2,19 @@ require 'test_helper'
class PhoneBooksControllerTest < ActionController::TestCase
setup do
- @tenant = Factory.create(:tenant)
+ @tenant = FactoryGirl.create(:tenant)
@admins = @tenant.user_groups.find_or_create_by_name('Admins')
@users = @tenant.user_groups.find_or_create_by_name('Users')
- @user = Factory.create(:user)
+ @user = FactoryGirl.create(:user)
@tenant.users << @user
@users.users << @user
- @personal_phone_book = Factory.create(:phone_book,
+ @personal_phone_book = FactoryGirl.create(:phone_book,
:phone_bookable_type => @user.class.to_s,
:phone_bookable_id => @user.id
)
- phone_book_entry = Factory.create(:phone_book_entry)
+ phone_book_entry = FactoryGirl.create(:phone_book_entry)
@personal_phone_book.phone_book_entries << phone_book_entry
@expected_status_if_not_authorized = :redirect
@@ -34,7 +34,7 @@ class PhoneBooksControllerTest < ActionController::TestCase
end
test "should create phone_book" do
- phone_book2 = Factory.build(:phone_book,
+ phone_book2 = FactoryGirl.build(:phone_book,
:phone_bookable_type => @user.class.to_s,
:phone_bookable_id => @user.id
)
diff --git a/test/functional/phone_models_controller_test.rb b/test/functional/phone_models_controller_test.rb
index 2d1a87a..199be45 100644
--- a/test/functional/phone_models_controller_test.rb
+++ b/test/functional/phone_models_controller_test.rb
@@ -4,21 +4,21 @@ class PhoneModelsControllerTest < ActionController::TestCase
setup do
# Create a tenant:
- @tenant = Factory.create(:tenant)
+ @tenant = FactoryGirl.create(:tenant)
# Create a User who is member of the Tenant but has no special rights:
- @user = Factory.create(:user)
+ @user = FactoryGirl.create(:user)
@tenant.tenant_memberships.create(:user_id => @user.id)
@user.update_attributes!(:current_tenant_id => @tenant.id)
# Create a User who is member of the Tenant and has super admin rights:
- @super_admin = Factory.create(:user)
+ @super_admin = FactoryGirl.create(:user)
@tenant.tenant_memberships.create(:user_id => @super_admin.id)
@super_admin.update_attributes!(:current_tenant_id => @tenant.id)
# Create a PhoneModel
#
- @phone_model = Factory.create(:phone_model)
+ @phone_model = FactoryGirl.create(:phone_model)
end
[ '@user.id', '' ].each do |user_id_code|
@@ -44,7 +44,7 @@ class PhoneModelsControllerTest < ActionController::TestCase
session[:user_id] = eval( user_id_code )
assert_no_difference('PhoneModel.count') do
- post :create, manufacturer_id: @phone_model.manufacturer_id, phone_model: Factory.build(:phone_model,
+ post :create, manufacturer_id: @phone_model.manufacturer_id, phone_model: FactoryGirl.build(:phone_model,
:manufacturer_id => @phone_model.manufacturer_id).attributes
end
end
@@ -106,7 +106,7 @@ class PhoneModelsControllerTest < ActionController::TestCase
# # add routes first.
# test "should create phone_model as super admin" do
# assert_difference('PhoneModel.count') do
- # post :create, phone_model: Factory.build(:phone_model,
+ # post :create, phone_model: FactoryGirl.build(:phone_model,
# :manufacturer_id => @phone_model.manufacturer_id).attributes
# end
#
diff --git a/test/functional/phone_number_ranges_controller_test.rb b/test/functional/phone_number_ranges_controller_test.rb
index 39f28c4..9569f3e 100644
--- a/test/functional/phone_number_ranges_controller_test.rb
+++ b/test/functional/phone_number_ranges_controller_test.rb
@@ -5,7 +5,7 @@ class PhoneNumberRangesControllerTest < ActionController::TestCase
#TODO Uncomment tests once the views are implemented.
setup do
- @phone_number_range = Factory.create(:phone_number_range)
+ @phone_number_range = FactoryGirl.create(:phone_number_range)
end
test "should get index" do
diff --git a/test/functional/phone_numbers_controller_test.rb b/test/functional/phone_numbers_controller_test.rb
index ab0a4b2..b11e3e8 100644
--- a/test/functional/phone_numbers_controller_test.rb
+++ b/test/functional/phone_numbers_controller_test.rb
@@ -3,8 +3,8 @@ require 'test_helper'
class PhoneNumbersControllerTest < ActionController::TestCase
setup do
- @tenant = Factory.create(:tenant)
- @user = Factory.create(:user)
+ @tenant = FactoryGirl.create(:tenant)
+ @user = FactoryGirl.create(:user)
@tenant.tenant_memberships.create(:user_id => @user.id)
@@ -12,11 +12,11 @@ class PhoneNumbersControllerTest < ActionController::TestCase
@private_phone_book = @user.phone_books.first
- @private_phone_book_entry = Factory.create(
+ @private_phone_book_entry = FactoryGirl.create(
:phone_book_entry,
:phone_book => @private_phone_book
)
- @phone_number = Factory.create(
+ @phone_number = FactoryGirl.create(
:phone_number,
:phone_numberable => @private_phone_book_entry
)
diff --git a/test/functional/phones_controller_test.rb b/test/functional/phones_controller_test.rb
index 1b0aa55..f2cc716 100644
--- a/test/functional/phones_controller_test.rb
+++ b/test/functional/phones_controller_test.rb
@@ -6,7 +6,7 @@ class PhonesControllerTest < ActionController::TestCase
#TODO Uncomment tests once the route has been implemented.
# setup do
-# @phone = Factory.create(:phone)
+# @phone = FactoryGirl.create(:phone)
# end
#
# test "should get index" do
@@ -24,7 +24,7 @@ class PhonesControllerTest < ActionController::TestCase
# #
# # test "should create phone" do
# # assert_difference('Phone.count') do
-# # post :create, phone: Factory.build(:phone, :phone_model_id => @phone.phone_model_id).attributes
+# # post :create, phone: FactoryGirl.build(:phone, :phone_model_id => @phone.phone_model_id).attributes
# # end
# #
# # assert_redirected_to phone_path(assigns(:phone))
diff --git a/test/functional/phones_sip_accounts_controller_test.rb b/test/functional/phones_sip_accounts_controller_test.rb
index 967b8fe..834e502 100644
--- a/test/functional/phones_sip_accounts_controller_test.rb
+++ b/test/functional/phones_sip_accounts_controller_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
class PhonesSipAccountsControllerTest < ActionController::TestCase
setup do
- @phones_sip_account = Factory.create(:phones_sip_account)
+ @phones_sip_account = FactoryGirl.create(:phones_sip_account)
end
# test "should get index" do
diff --git a/test/functional/sip_accounts_controller_test.rb b/test/functional/sip_accounts_controller_test.rb
index 5c97dd2..e079718 100644
--- a/test/functional/sip_accounts_controller_test.rb
+++ b/test/functional/sip_accounts_controller_test.rb
@@ -3,10 +3,10 @@ require 'test_helper'
class SipAccountsControllerTest < ActionController::TestCase
setup do
- @tenant = Factory.create(:tenant)
- @user = Factory.create(:user)
+ @tenant = FactoryGirl.create(:tenant)
+ @user = FactoryGirl.create(:user)
@tenant.tenant_memberships.create(:user_id => @user.id)
- @sip_account = @user.sip_accounts.create( Factory.build(:sip_account).attributes )
+ @sip_account = @user.sip_accounts.create( FactoryGirl.build(:sip_account).attributes )
@parent_param = @sip_account.sip_accountable_type.foreign_key.to_sym
@parent_id = @sip_account.sip_accountable.id
@@ -32,7 +32,7 @@ class SipAccountsControllerTest < ActionController::TestCase
assert_difference('SipAccount.count') do
post :create,
@parent_param => @parent_id,
- sip_account: Factory.attributes_for(:sip_account)
+ sip_account: FactoryGirl.attributes_for(:sip_account)
end
end
diff --git a/test/functional/sip_domains_controller_test.rb b/test/functional/sip_domains_controller_test.rb
index f26ea02..5cbd519 100644
--- a/test/functional/sip_domains_controller_test.rb
+++ b/test/functional/sip_domains_controller_test.rb
@@ -2,7 +2,7 @@ require 'test_helper'
class SipDomainsControllerTest < ActionController::TestCase
setup do
- @sip_domain = Factory.create(:sip_domain)
+ @sip_domain = FactoryGirl.create(:sip_domain)
end
test "should get index" do
@@ -18,7 +18,7 @@ class SipDomainsControllerTest < ActionController::TestCase
test "should create sip_domain" do
assert_difference('SipDomain.count') do
- post :create, sip_domain: Factory.build(:sip_domain).attributes
+ post :create, sip_domain: FactoryGirl.build(:sip_domain).attributes
end
assert_redirected_to sip_domain_path(assigns(:sip_domain))
diff --git a/test/functional/tenants_controller_test.rb b/test/functional/tenants_controller_test.rb
index b4e2df4..7c5ec93 100644
--- a/test/functional/tenants_controller_test.rb
+++ b/test/functional/tenants_controller_test.rb
@@ -4,7 +4,7 @@ class TenantsControllerTest < ActionController::TestCase
# TODO Create tests which test that a login user has specific rights.
# setup do
- # @tenant = Factory.create(:tenant)
+ # @tenant = FactoryGirl.create(:tenant)
# end
#
# test "should get index" do
@@ -20,7 +20,7 @@ class TenantsControllerTest < ActionController::TestCase
#
# test "should create tenant" do
# assert_difference('Tenant.count') do
- # post :create, tenant: Factory.build(:tenant).attributes
+ # post :create, tenant: FactoryGirl.build(:tenant).attributes
# end
#
# assert_redirected_to tenant_path(assigns(:tenant))
diff --git a/test/functional/user_groups_controller_test.rb b/test/functional/user_groups_controller_test.rb
index 0e39048..6f0c753 100644
--- a/test/functional/user_groups_controller_test.rb
+++ b/test/functional/user_groups_controller_test.rb
@@ -4,7 +4,7 @@ class UserGroupsControllerTest < ActionController::TestCase
# TODO Create tests which test that a login user has specific rights.
# setup do
- # @user_group = Factory.create(:user_group)
+ # @user_group = FactoryGirl.create(:user_group)
# end
#
# test "should get index" do
@@ -20,7 +20,7 @@ class UserGroupsControllerTest < ActionController::TestCase
#
# test "should create user_group" do
# assert_difference('UserGroup.count') do
- # post :create, user_group: Factory.build(:user_group).attributes
+ # post :create, user_group: FactoryGirl.build(:user_group).attributes
# end
#
# assert_redirected_to user_group_path(assigns(:user_group))
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index d1898f7..987b3df 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -2,8 +2,8 @@ require 'test_helper'
class UsersControllerTest < ActionController::TestCase
setup do
- @tenant = Factory.create(:tenant)
- @user = Factory.create(:user)
+ @tenant = FactoryGirl.create(:tenant)
+ @user = FactoryGirl.create(:user)
@tenant.tenant_memberships.create(:user_id => @user.id)
@@ -30,7 +30,7 @@ class UsersControllerTest < ActionController::TestCase
# test "should create user" do
# session[:user_id] = nil
# assert_difference('User.count') do
- # post :create, user: Factory.build(:user).attributes
+ # post :create, user: FactoryGirl.build(:user).attributes
# end
#
# # assert_redirected_to user_path(assigns(:user))
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