diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-22 15:33:06 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-22 15:33:06 +0100 |
commit | 39aa7132ceed3d4beab3a9b828e571bbfc67c07e (patch) | |
tree | 6c88289c9f99be0af8635636fcdf64102090e5ec /test/factories | |
parent | 5ad8203ce4f1bfea997960d0b52c626dea24b944 (diff) | |
parent | 6f69c1a85055ec7c2515719d79d2a7a4e60cec50 (diff) |
Merge branch 'develop'5.1-beta1
Diffstat (limited to 'test/factories')
-rw-r--r-- | test/factories/area_codes.rb | 10 | ||||
-rw-r--r-- | test/factories/call_forwards.rb | 28 | ||||
-rw-r--r-- | test/factories/conference_invitees.rb | 12 | ||||
-rw-r--r-- | test/factories/conferences.rb | 12 | ||||
-rw-r--r-- | test/factories/countries.rb | 12 | ||||
-rw-r--r-- | test/factories/gemeinschaft_setups.rb | 12 | ||||
-rw-r--r-- | test/factories/languages.rb | 8 | ||||
-rw-r--r-- | test/factories/manufacturers.rb | 8 | ||||
-rw-r--r-- | test/factories/ouis.rb | 8 | ||||
-rw-r--r-- | test/factories/phone_book_entries.rb | 10 | ||||
-rw-r--r-- | test/factories/phone_books.rb | 8 | ||||
-rw-r--r-- | test/factories/phone_models.rb | 8 | ||||
-rw-r--r-- | test/factories/phone_number_ranges.rb | 8 | ||||
-rw-r--r-- | test/factories/phone_numbers.rb | 10 | ||||
-rw-r--r-- | test/factories/phones.rb | 22 | ||||
-rw-r--r-- | test/factories/sip_accounts.rb | 26 | ||||
-rw-r--r-- | test/factories/sip_domains.rb | 8 | ||||
-rw-r--r-- | test/factories/tenant_memberships.rb | 8 | ||||
-rw-r--r-- | test/factories/tenants.rb | 11 | ||||
-rw-r--r-- | test/factories/user_group_memberships.rb | 22 | ||||
-rw-r--r-- | test/factories/user_groups.rb | 8 | ||||
-rw-r--r-- | test/factories/users.rb | 18 |
22 files changed, 160 insertions, 117 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..306fdee 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 |