summaryrefslogtreecommitdiff
path: root/test/factories
diff options
context:
space:
mode:
Diffstat (limited to 'test/factories')
-rw-r--r--test/factories/api_rows.rb17
-rw-r--r--test/factories/area_codes.rb7
-rw-r--r--test/factories/call_forwards.rb16
-rw-r--r--test/factories/conference_invitees.rb8
-rw-r--r--test/factories/conferences.rb8
-rw-r--r--test/factories/countries.rb8
-rw-r--r--test/factories/gemeinschaft_setups.rb8
-rw-r--r--test/factories/gui_function_memberships.rb10
-rw-r--r--test/factories/languages.rb6
-rw-r--r--test/factories/manufacturers.rb6
-rw-r--r--test/factories/ouis.rb6
-rw-r--r--test/factories/phone_book_entries.rb7
-rw-r--r--test/factories/phone_books.rb6
-rw-r--r--test/factories/phone_models.rb6
-rw-r--r--test/factories/phone_number_ranges.rb6
-rw-r--r--test/factories/phone_numbers.rb7
-rw-r--r--test/factories/phones.rb15
-rw-r--r--test/factories/sip_accounts.rb17
-rw-r--r--test/factories/sip_domains.rb6
-rw-r--r--test/factories/softkey_functions.rb7
-rw-r--r--test/factories/tenant_memberships.rb6
-rw-r--r--test/factories/tenants.rb8
-rw-r--r--test/factories/user_group_memberships.rb14
-rw-r--r--test/factories/user_groups.rb6
-rw-r--r--test/factories/users.rb11
25 files changed, 222 insertions, 0 deletions
diff --git a/test/factories/api_rows.rb b/test/factories/api_rows.rb
new file mode 100644
index 0000000..42428ae
--- /dev/null
+++ b/test/factories/api_rows.rb
@@ -0,0 +1,17 @@
+# Read about factories at http://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :row do
+ user_name "MyString"
+ last_name "MyString"
+ middle_name "MyString"
+ first_name "MyString"
+ office_phone_number "MyString"
+ internal_extension "MyString"
+ mobile_phone_number "MyString"
+ fax_phone_number "MyString"
+ email "MyString"
+ pin "MyString"
+ photo_file_name "MyString"
+ end
+end
diff --git a/test/factories/area_codes.rb b/test/factories/area_codes.rb
new file mode 100644
index 0000000..87b2271
--- /dev/null
+++ b/test/factories/area_codes.rb
@@ -0,0 +1,7 @@
+# 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
+end \ No newline at end of file
diff --git a/test/factories/call_forwards.rb b/test/factories/call_forwards.rb
new file mode 100644
index 0000000..d275e9d
--- /dev/null
+++ b/test/factories/call_forwards.rb
@@ -0,0 +1,16 @@
+# 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 }
+end
diff --git a/test/factories/conference_invitees.rb b/test/factories/conference_invitees.rb
new file mode 100644
index 0000000..4e1eb68
--- /dev/null
+++ b/test/factories/conference_invitees.rb
@@ -0,0 +1,8 @@
+# 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
+end \ No newline at end of file
diff --git a/test/factories/conferences.rb b/test/factories/conferences.rb
new file mode 100644
index 0000000..3c49a7a
--- /dev/null
+++ b/test/factories/conferences.rb
@@ -0,0 +1,8 @@
+# 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
+end \ No newline at end of file
diff --git a/test/factories/countries.rb b/test/factories/countries.rb
new file mode 100644
index 0000000..cc3fc88
--- /dev/null
+++ b/test/factories/countries.rb
@@ -0,0 +1,8 @@
+# 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}" }
+end \ No newline at end of file
diff --git a/test/factories/gemeinschaft_setups.rb b/test/factories/gemeinschaft_setups.rb
new file mode 100644
index 0000000..ed69bc3
--- /dev/null
+++ b/test/factories/gemeinschaft_setups.rb
@@ -0,0 +1,8 @@
+# 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
+end \ No newline at end of file
diff --git a/test/factories/gui_function_memberships.rb b/test/factories/gui_function_memberships.rb
new file mode 100644
index 0000000..c6f6d4a
--- /dev/null
+++ b/test/factories/gui_function_memberships.rb
@@ -0,0 +1,10 @@
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :gui_function_membership do
+ gui_function_id 1
+ user_group_id 1
+ activated false
+ output "MyString"
+ end
+end
diff --git a/test/factories/languages.rb b/test/factories/languages.rb
new file mode 100644
index 0000000..29d2ece
--- /dev/null
+++ b/test/factories/languages.rb
@@ -0,0 +1,6 @@
+# Read about factories at http://github.com/thoughtbot/factory_girl
+
+Factory.define :language do |f|
+ f.name 'Deutsch'
+ f.code 'de'
+end \ No newline at end of file
diff --git a/test/factories/manufacturers.rb b/test/factories/manufacturers.rb
new file mode 100644
index 0000000..f091dd2
--- /dev/null
+++ b/test/factories/manufacturers.rb
@@ -0,0 +1,6 @@
+# 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" }
+end \ No newline at end of file
diff --git a/test/factories/ouis.rb b/test/factories/ouis.rb
new file mode 100644
index 0000000..3a90fd4
--- /dev/null
+++ b/test/factories/ouis.rb
@@ -0,0 +1,6 @@
+# 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 }
+end \ No newline at end of file
diff --git a/test/factories/phone_book_entries.rb b/test/factories/phone_book_entries.rb
new file mode 100644
index 0000000..7427886
--- /dev/null
+++ b/test/factories/phone_book_entries.rb
@@ -0,0 +1,7 @@
+# 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
+end
diff --git a/test/factories/phone_books.rb b/test/factories/phone_books.rb
new file mode 100644
index 0000000..4aa8d07
--- /dev/null
+++ b/test/factories/phone_books.rb
@@ -0,0 +1,6 @@
+# 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
+end
diff --git a/test/factories/phone_models.rb b/test/factories/phone_models.rb
new file mode 100644
index 0000000..8e6a50f
--- /dev/null
+++ b/test/factories/phone_models.rb
@@ -0,0 +1,6 @@
+# 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
+end
diff --git a/test/factories/phone_number_ranges.rb b/test/factories/phone_number_ranges.rb
new file mode 100644
index 0000000..cb2f7ee
--- /dev/null
+++ b/test/factories/phone_number_ranges.rb
@@ -0,0 +1,6 @@
+# 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
+end
diff --git a/test/factories/phone_numbers.rb b/test/factories/phone_numbers.rb
new file mode 100644
index 0000000..74b43cc
--- /dev/null
+++ b/test/factories/phone_numbers.rb
@@ -0,0 +1,7 @@
+# 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
+end \ No newline at end of file
diff --git a/test/factories/phones.rb b/test/factories/phones.rb
new file mode 100644
index 0000000..646d548
--- /dev/null
+++ b/test/factories/phones.rb
@@ -0,0 +1,15 @@
+# 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
+
+ # 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)
+ )
+ end
+end \ No newline at end of file
diff --git a/test/factories/sip_accounts.rb b/test/factories/sip_accounts.rb
new file mode 100644
index 0000000..2f91717
--- /dev/null
+++ b/test/factories/sip_accounts.rb
@@ -0,0 +1,17 @@
+# 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
+ end
+ end
+end
diff --git a/test/factories/sip_domains.rb b/test/factories/sip_domains.rb
new file mode 100644
index 0000000..347b6a6
--- /dev/null
+++ b/test/factories/sip_domains.rb
@@ -0,0 +1,6 @@
+# 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" }
+end
diff --git a/test/factories/softkey_functions.rb b/test/factories/softkey_functions.rb
new file mode 100644
index 0000000..6af7cac
--- /dev/null
+++ b/test/factories/softkey_functions.rb
@@ -0,0 +1,7 @@
+# Read about factories at http://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :softkey_function do
+ name "MyString"
+ end
+end
diff --git a/test/factories/tenant_memberships.rb b/test/factories/tenant_memberships.rb
new file mode 100644
index 0000000..ee52367
--- /dev/null
+++ b/test/factories/tenant_memberships.rb
@@ -0,0 +1,6 @@
+# Read about factories at http://github.com/thoughtbot/factory_girl
+
+Factory.define :tenant_membership do |f|
+ f.association :user
+ f.association :tenant
+end \ No newline at end of file
diff --git a/test/factories/tenants.rb b/test/factories/tenants.rb
new file mode 100644
index 0000000..9a62e93
--- /dev/null
+++ b/test/factories/tenants.rb
@@ -0,0 +1,8 @@
+# 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
+end
diff --git a/test/factories/user_group_memberships.rb b/test/factories/user_group_memberships.rb
new file mode 100644
index 0000000..7904f2f
--- /dev/null
+++ b/test/factories/user_group_memberships.rb
@@ -0,0 +1,14 @@
+# 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
+ )
+ end
+end \ No newline at end of file
diff --git a/test/factories/user_groups.rb b/test/factories/user_groups.rb
new file mode 100644
index 0000000..9a448ec
--- /dev/null
+++ b/test/factories/user_groups.rb
@@ -0,0 +1,6 @@
+# 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
+end \ No newline at end of file
diff --git a/test/factories/users.rb b/test/factories/users.rb
new file mode 100644
index 0000000..3d53141
--- /dev/null
+++ b/test/factories/users.rb
@@ -0,0 +1,11 @@
+# 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
+end \ No newline at end of file