diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-30 22:03:10 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-30 22:03:10 +0100 |
commit | 4e716cea253be9293b247fbe74d25fe288b7853f (patch) | |
tree | e7d5ba33b69dfcfbc910d157ca65591a8f022c5b /test/functional | |
parent | cac008f58299c443557867588288d7c954026dd2 (diff) |
Converted Factory to FactoryGirl.
Diffstat (limited to 'test/functional')
18 files changed, 52 insertions, 52 deletions
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)) |