summaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-17 12:01:45 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-17 12:01:45 +0100
commitb80bd744ad873f6fc43018bc4bfb90677de167bd (patch)
tree072c4b0e33d442528555b82c415f5e7a1712b2b0 /test/functional
parent3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff)
Start of GS5.
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/.gitkeep0
-rw-r--r--test/functional/access_authorizations_controller_test.rb49
-rw-r--r--test/functional/acd_agents_controller_test.rb49
-rw-r--r--test/functional/acd_callers_controller_test.rb49
-rw-r--r--test/functional/addresses_controller_test.rb49
-rw-r--r--test/functional/api/rows_controller_test.rb49
-rw-r--r--test/functional/automatic_call_distributors_controller_test.rb49
-rw-r--r--test/functional/call_forwards_controller_test.rb91
-rw-r--r--test/functional/callthroughs_controller_test.rb49
-rw-r--r--test/functional/conference_invitees_controller_test.rb49
-rw-r--r--test/functional/conferences_controller_test.rb49
-rw-r--r--test/functional/config_siemens_controller_test.rb7
-rw-r--r--test/functional/fax_accounts_controller_test.rb49
-rw-r--r--test/functional/fax_documents_controller_test.rb49
-rw-r--r--test/functional/gemeinschaft_setups_controller_test.rb50
-rw-r--r--test/functional/gs_cluster_sync_log_entries_controller_test.rb49
-rw-r--r--test/functional/gs_nodes_controller_test.rb49
-rw-r--r--test/functional/gui_functions_controller_test.rb49
-rw-r--r--test/functional/hunt_group_members_controller_test.rb49
-rw-r--r--test/functional/hunt_groups_controller_test.rb49
-rw-r--r--test/functional/manufacturers_controller_test.rb77
-rw-r--r--test/functional/notifications_test.rb12
-rw-r--r--test/functional/page_controller_test.rb35
-rw-r--r--test/functional/phone_book_entries_controller_test.rb103
-rw-r--r--test/functional/phone_books_controller_test.rb71
-rw-r--r--test/functional/phone_models_controller_test.rb143
-rw-r--r--test/functional/phone_number_ranges_controller_test.rb78
-rw-r--r--test/functional/phone_numbers_controller_test.rb115
-rw-r--r--test/functional/phone_sip_accounts_controller_test.rb49
-rw-r--r--test/functional/phones_controller_test.rb55
-rw-r--r--test/functional/phones_sip_accounts_controller_test.rb49
-rw-r--r--test/functional/ringtones_controller_test.rb49
-rw-r--r--test/functional/sessions_controller_test.rb7
-rw-r--r--test/functional/sip_accounts_controller_test.rb76
-rw-r--r--test/functional/sip_domains_controller_test.rb49
-rw-r--r--test/functional/softkeys_controller_test.rb49
-rw-r--r--test/functional/system_messages_controller_test.rb49
-rw-r--r--test/functional/tenants_controller_test.rb51
-rw-r--r--test/functional/user_groups_controller_test.rb51
-rw-r--r--test/functional/users_controller_test.rb65
-rw-r--r--test/functional/whitelists_controller_test.rb49
41 files changed, 2214 insertions, 0 deletions
diff --git a/test/functional/.gitkeep b/test/functional/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/functional/.gitkeep
diff --git a/test/functional/access_authorizations_controller_test.rb b/test/functional/access_authorizations_controller_test.rb
new file mode 100644
index 0000000..98761fd
--- /dev/null
+++ b/test/functional/access_authorizations_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class AccessAuthorizationsControllerTest < ActionController::TestCase
+ setup do
+ @access_authorization = access_authorizations(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:access_authorizations)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create access_authorization" do
+ assert_difference('AccessAuthorization.count') do
+ post :create, access_authorization: @access_authorization.attributes
+ end
+
+ assert_redirected_to access_authorization_path(assigns(:access_authorization))
+ end
+
+ test "should show access_authorization" do
+ get :show, id: @access_authorization.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @access_authorization.to_param
+ assert_response :success
+ end
+
+ test "should update access_authorization" do
+ put :update, id: @access_authorization.to_param, access_authorization: @access_authorization.attributes
+ assert_redirected_to access_authorization_path(assigns(:access_authorization))
+ end
+
+ test "should destroy access_authorization" do
+ assert_difference('AccessAuthorization.count', -1) do
+ delete :destroy, id: @access_authorization.to_param
+ end
+
+ assert_redirected_to access_authorizations_path
+ end
+end
diff --git a/test/functional/acd_agents_controller_test.rb b/test/functional/acd_agents_controller_test.rb
new file mode 100644
index 0000000..11355eb
--- /dev/null
+++ b/test/functional/acd_agents_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class AcdAgentsControllerTest < ActionController::TestCase
+ setup do
+ @acd_agent = acd_agents(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:acd_agents)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create acd_agent" do
+ assert_difference('AcdAgent.count') do
+ post :create, acd_agent: @acd_agent.attributes
+ end
+
+ assert_redirected_to acd_agent_path(assigns(:acd_agent))
+ end
+
+ test "should show acd_agent" do
+ get :show, id: @acd_agent.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @acd_agent.to_param
+ assert_response :success
+ end
+
+ test "should update acd_agent" do
+ put :update, id: @acd_agent.to_param, acd_agent: @acd_agent.attributes
+ assert_redirected_to acd_agent_path(assigns(:acd_agent))
+ end
+
+ test "should destroy acd_agent" do
+ assert_difference('AcdAgent.count', -1) do
+ delete :destroy, id: @acd_agent.to_param
+ end
+
+ assert_redirected_to acd_agents_path
+ end
+end
diff --git a/test/functional/acd_callers_controller_test.rb b/test/functional/acd_callers_controller_test.rb
new file mode 100644
index 0000000..960de7d
--- /dev/null
+++ b/test/functional/acd_callers_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class AcdCallersControllerTest < ActionController::TestCase
+ setup do
+ @acd_caller = acd_callers(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:acd_callers)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create acd_caller" do
+ assert_difference('AcdCaller.count') do
+ post :create, acd_caller: @acd_caller.attributes
+ end
+
+ assert_redirected_to acd_caller_path(assigns(:acd_caller))
+ end
+
+ test "should show acd_caller" do
+ get :show, id: @acd_caller.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @acd_caller.to_param
+ assert_response :success
+ end
+
+ test "should update acd_caller" do
+ put :update, id: @acd_caller.to_param, acd_caller: @acd_caller.attributes
+ assert_redirected_to acd_caller_path(assigns(:acd_caller))
+ end
+
+ test "should destroy acd_caller" do
+ assert_difference('AcdCaller.count', -1) do
+ delete :destroy, id: @acd_caller.to_param
+ end
+
+ assert_redirected_to acd_callers_path
+ end
+end
diff --git a/test/functional/addresses_controller_test.rb b/test/functional/addresses_controller_test.rb
new file mode 100644
index 0000000..b1f5c83
--- /dev/null
+++ b/test/functional/addresses_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class AddressesControllerTest < ActionController::TestCase
+# setup do
+# @address = addresses(:one)
+# end
+#
+# test "should get index" do
+# get :index
+# assert_response :success
+# assert_not_nil assigns(:addresses)
+# end
+#
+# test "should get new" do
+# get :new
+# assert_response :success
+# end
+#
+# test "should create address" do
+# assert_difference('Address.count') do
+# post :create, address: @address.attributes
+# end
+#
+# assert_redirected_to address_path(assigns(:address))
+# end
+#
+# test "should show address" do
+# get :show, id: @address.to_param
+# assert_response :success
+# end
+#
+# test "should get edit" do
+# get :edit, id: @address.to_param
+# assert_response :success
+# end
+#
+# test "should update address" do
+# put :update, id: @address.to_param, address: @address.attributes
+# assert_redirected_to address_path(assigns(:address))
+# end
+#
+# test "should destroy address" do
+# assert_difference('Address.count', -1) do
+# delete :destroy, id: @address.to_param
+# end
+#
+# assert_redirected_to addresses_path
+# end
+end
diff --git a/test/functional/api/rows_controller_test.rb b/test/functional/api/rows_controller_test.rb
new file mode 100644
index 0000000..ca1926c
--- /dev/null
+++ b/test/functional/api/rows_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class Api::RowsControllerTest < ActionController::TestCase
+ setup do
+ @api_row = api_rows(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:api_rows)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create api_row" do
+ assert_difference('Api::Row.count') do
+ post :create, api_row: @api_row.attributes
+ end
+
+ assert_redirected_to api_row_path(assigns(:api_row))
+ end
+
+ test "should show api_row" do
+ get :show, id: @api_row
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @api_row
+ assert_response :success
+ end
+
+ test "should update api_row" do
+ put :update, id: @api_row, api_row: @api_row.attributes
+ assert_redirected_to api_row_path(assigns(:api_row))
+ end
+
+ test "should destroy api_row" do
+ assert_difference('Api::Row.count', -1) do
+ delete :destroy, id: @api_row
+ end
+
+ assert_redirected_to api_rows_path
+ end
+end
diff --git a/test/functional/automatic_call_distributors_controller_test.rb b/test/functional/automatic_call_distributors_controller_test.rb
new file mode 100644
index 0000000..e8914fd
--- /dev/null
+++ b/test/functional/automatic_call_distributors_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class AutomaticCallDistributorsControllerTest < ActionController::TestCase
+ setup do
+ @automatic_call_distributor = automatic_call_distributors(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:automatic_call_distributors)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create automatic_call_distributor" do
+ assert_difference('AutomaticCallDistributor.count') do
+ post :create, automatic_call_distributor: @automatic_call_distributor.attributes
+ end
+
+ assert_redirected_to automatic_call_distributor_path(assigns(:automatic_call_distributor))
+ end
+
+ test "should show automatic_call_distributor" do
+ get :show, id: @automatic_call_distributor.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @automatic_call_distributor.to_param
+ assert_response :success
+ end
+
+ test "should update automatic_call_distributor" do
+ put :update, id: @automatic_call_distributor.to_param, automatic_call_distributor: @automatic_call_distributor.attributes
+ assert_redirected_to automatic_call_distributor_path(assigns(:automatic_call_distributor))
+ end
+
+ test "should destroy automatic_call_distributor" do
+ assert_difference('AutomaticCallDistributor.count', -1) do
+ delete :destroy, id: @automatic_call_distributor.to_param
+ end
+
+ assert_redirected_to automatic_call_distributors_path
+ end
+end
diff --git a/test/functional/call_forwards_controller_test.rb b/test/functional/call_forwards_controller_test.rb
new file mode 100644
index 0000000..0993623
--- /dev/null
+++ b/test/functional/call_forwards_controller_test.rb
@@ -0,0 +1,91 @@
+require 'test_helper'
+
+class CallForwardsControllerTest < ActionController::TestCase
+
+ setup do
+ @user = Factory.create(:user)
+
+ #@tenant = Factory.create(:tenant)
+ #@tenant.tenant_memberships.create(:user_id => @user.id)
+ #@user.update_attributes!(:current_tenant_id => @tenant.id)
+
+ @sip_account = Factory.create(
+ :sip_account,
+ :sip_accountable => @user,
+ )
+ @user.sip_accounts << @sip_account
+ @sip_account = @user.sip_accounts.last
+
+ @phone_number = Factory.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,
+ :phone_number => @phone_number,
+ )
+ @phone_number.call_forwards << @call_forward
+ @call_forward = @phone_number.call_forwards.last
+ end
+
+ test "should get index" do
+ session[:user_id] = @user.id
+ get :index,
+ :phone_number_id => @phone_number.to_param
+ assert_response :success
+ assert_not_nil assigns(:call_forwards)
+ end
+
+ test "should get new" do
+ get :new,
+ :phone_number_id => @phone_number.to_param
+ assert_response :success
+ end
+
+ #TODO
+# test "should create call_forward" do
+# assert_difference('CallForward.count') do
+# post :create,
+# :phone_number_id => @phone_number.to_param,
+# :call_forward => Factory.attributes_for(
+# :call_forward
+# )
+# end
+# assert_redirected_to( phone_number_call_forward_path( @phone_number, @call_forward ) )
+# end
+
+ test "should show call_forward" do
+ session[:user_id] = @user.id
+ get :show,
+ :phone_number_id => @phone_number.to_param,
+ :id => @call_forward.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit,
+ :phone_number_id => @phone_number.to_param,
+ :id => @call_forward.to_param
+ assert_response :success
+ end
+
+ test "should update call_forward" do
+ put :update,
+ :phone_number_id => @phone_number.to_param,
+ :id => @call_forward.to_param, call_forward: @call_forward.attributes
+ assert_redirected_to( phone_number_call_forward_path( @phone_number, @call_forward ) )
+ end
+
+ test "should destroy call_forward" do
+ assert_difference('CallForward.count', -1) do
+ delete :destroy,
+ :phone_number_id => @phone_number.to_param,
+ :id => @call_forward.to_param
+ end
+ assert_redirected_to( phone_number_call_forwards_path( @phone_number ) )
+ end
+
+end
diff --git a/test/functional/callthroughs_controller_test.rb b/test/functional/callthroughs_controller_test.rb
new file mode 100644
index 0000000..330629c
--- /dev/null
+++ b/test/functional/callthroughs_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class CallthroughsControllerTest < ActionController::TestCase
+ setup do
+ @callthrough = callthroughs(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:callthroughs)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create callthrough" do
+ assert_difference('Callthrough.count') do
+ post :create, callthrough: @callthrough.attributes
+ end
+
+ assert_redirected_to callthrough_path(assigns(:callthrough))
+ end
+
+ test "should show callthrough" do
+ get :show, id: @callthrough.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @callthrough.to_param
+ assert_response :success
+ end
+
+ test "should update callthrough" do
+ put :update, id: @callthrough.to_param, callthrough: @callthrough.attributes
+ assert_redirected_to callthrough_path(assigns(:callthrough))
+ end
+
+ test "should destroy callthrough" do
+ assert_difference('Callthrough.count', -1) do
+ delete :destroy, id: @callthrough.to_param
+ end
+
+ assert_redirected_to callthroughs_path
+ end
+end
diff --git a/test/functional/conference_invitees_controller_test.rb b/test/functional/conference_invitees_controller_test.rb
new file mode 100644
index 0000000..72d2e2c
--- /dev/null
+++ b/test/functional/conference_invitees_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class ConferenceInviteesControllerTest < ActionController::TestCase
+
+ setup do
+ @conference_invitee = Factory.create(:conference_invitee)
+ end
+
+# test "should get index" do
+# get :index
+# assert_response :success
+# assert_not_nil assigns(:conference_invitees)
+# end
+#
+# test "should get new" do
+# get :new
+# assert_response :success
+# end
+#
+# test "should create conference_invitee" do
+# assert_difference('ConferenceInvitee.count') do
+# post :create, conference_invitee: @conference_invitee.attributes
+# end
+# assert_redirected_to conference_invitee_path(assigns(:conference_invitee))
+# end
+#
+# test "should show conference_invitee" do
+# get :show, id: @conference_invitee.to_param
+# assert_response :success
+# end
+#
+# test "should get edit" do
+# get :edit, id: @conference_invitee.to_param
+# assert_response :success
+# end
+#
+# test "should update conference_invitee" do
+# put :update, id: @conference_invitee.to_param, conference_invitee: @conference_invitee.attributes
+# assert_redirected_to conference_invitee_path(assigns(:conference_invitee))
+# end
+#
+# test "should destroy conference_invitee" do
+# assert_difference('ConferenceInvitee.count', -1) do
+# delete :destroy, id: @conference_invitee.to_param
+# end
+# assert_redirected_to conference_invitees_path
+# end
+
+end
diff --git a/test/functional/conferences_controller_test.rb b/test/functional/conferences_controller_test.rb
new file mode 100644
index 0000000..954838b
--- /dev/null
+++ b/test/functional/conferences_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class ConferencesControllerTest < ActionController::TestCase
+
+ setup do
+ @conference = Factory.create(:conference)
+ end
+
+# test "should get index" do
+# get :index
+# assert_response :success
+# assert_not_nil assigns(:conferences)
+# end
+#
+# test "should get new" do
+# get :new
+# assert_response :success
+# end
+#
+# test "should create conference" do
+# assert_difference('Conference.count') do
+# post :create, conference: @conference.attributes
+# end
+# assert_redirected_to conference_path(assigns(:conference))
+# end
+#
+# test "should show conference" do
+# get :show, id: @conference.to_param
+# assert_response :success
+# end
+#
+# test "should get edit" do
+# get :edit, id: @conference.to_param
+# assert_response :success
+# end
+#
+# test "should update conference" do
+# put :update, id: @conference.to_param, conference: @conference.attributes
+# assert_redirected_to conference_path(assigns(:conference))
+# end
+#
+# test "should destroy conference" do
+# assert_difference('Conference.count', -1) do
+# delete :destroy, id: @conference.to_param
+# end
+# assert_redirected_to conferences_path
+# end
+
+end
diff --git a/test/functional/config_siemens_controller_test.rb b/test/functional/config_siemens_controller_test.rb
new file mode 100644
index 0000000..949f776
--- /dev/null
+++ b/test/functional/config_siemens_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class ConfigSiemensControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/functional/fax_accounts_controller_test.rb b/test/functional/fax_accounts_controller_test.rb
new file mode 100644
index 0000000..64b781d
--- /dev/null
+++ b/test/functional/fax_accounts_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class FaxAccountsControllerTest < ActionController::TestCase
+ setup do
+ @fax_account = fax_accounts(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:fax_accounts)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create fax_account" do
+ assert_difference('FaxAccount.count') do
+ post :create, fax_account: @fax_account.attributes
+ end
+
+ assert_redirected_to fax_account_path(assigns(:fax_account))
+ end
+
+ test "should show fax_account" do
+ get :show, id: @fax_account.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @fax_account.to_param
+ assert_response :success
+ end
+
+ test "should update fax_account" do
+ put :update, id: @fax_account.to_param, fax_account: @fax_account.attributes
+ assert_redirected_to fax_account_path(assigns(:fax_account))
+ end
+
+ test "should destroy fax_account" do
+ assert_difference('FaxAccount.count', -1) do
+ delete :destroy, id: @fax_account.to_param
+ end
+
+ assert_redirected_to fax_accounts_path
+ end
+end
diff --git a/test/functional/fax_documents_controller_test.rb b/test/functional/fax_documents_controller_test.rb
new file mode 100644
index 0000000..0322c61
--- /dev/null
+++ b/test/functional/fax_documents_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class FaxDocumentsControllerTest < ActionController::TestCase
+ setup do
+ @fax_document = fax_documents(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:fax_documents)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create fax_document" do
+ assert_difference('FaxDocument.count') do
+ post :create, fax_document: @fax_document.attributes
+ end
+
+ assert_redirected_to fax_document_path(assigns(:fax_document))
+ end
+
+ test "should show fax_document" do
+ get :show, id: @fax_document.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @fax_document.to_param
+ assert_response :success
+ end
+
+ test "should update fax_document" do
+ put :update, id: @fax_document.to_param, fax_document: @fax_document.attributes
+ assert_redirected_to fax_document_path(assigns(:fax_document))
+ end
+
+ test "should destroy fax_document" do
+ assert_difference('FaxDocument.count', -1) do
+ delete :destroy, id: @fax_document.to_param
+ end
+
+ assert_redirected_to fax_documents_path
+ end
+end
diff --git a/test/functional/gemeinschaft_setups_controller_test.rb b/test/functional/gemeinschaft_setups_controller_test.rb
new file mode 100644
index 0000000..b23a878
--- /dev/null
+++ b/test/functional/gemeinschaft_setups_controller_test.rb
@@ -0,0 +1,50 @@
+require 'test_helper'
+
+class GemeinschaftSetupsControllerTest < ActionController::TestCase
+
+ setup do
+ @gemeinschaft_setup = Factory.build(:gemeinschaft_setup)
+ end
+
+# test "should get index" do
+# get :index
+# assert_response :success
+# assert_not_nil assigns(:gemeinschaft_setups)
+# end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+# test "should create gemeinschaft_setup" do
+# assert_difference('GemeinschaftSetup.count') do
+# post :create,
+# gemeinschaft_setup: Factory.attributes_for(:gemeinschaft_setup)
+# end
+# assert_redirected_to gemeinschaft_setup_path(assigns(:gemeinschaft_setup))
+# end
+
+# test "should show gemeinschaft_setup" do
+# get :show, id: @gemeinschaft_setup.to_param
+# assert_response :success
+# end
+
+# test "should get edit" do
+# get :edit, id: @gemeinschaft_setup.to_param
+# assert_response :success
+# end
+
+# test "should update gemeinschaft_setup" do
+# put :update, id: @gemeinschaft_setup.to_param, gemeinschaft_setup: @gemeinschaft_setup.attributes
+# assert_redirected_to gemeinschaft_setup_path(assigns(:gemeinschaft_setup))
+# end
+
+# test "should destroy gemeinschaft_setup" do
+# assert_difference('GemeinschaftSetup.count', -1) do
+# delete :destroy, id: @gemeinschaft_setup.to_param
+# end
+# assert_redirected_to gemeinschaft_setups_path
+# end
+
+end
diff --git a/test/functional/gs_cluster_sync_log_entries_controller_test.rb b/test/functional/gs_cluster_sync_log_entries_controller_test.rb
new file mode 100644
index 0000000..f8fa336
--- /dev/null
+++ b/test/functional/gs_cluster_sync_log_entries_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class GsClusterSyncLogEntriesControllerTest < ActionController::TestCase
+ setup do
+ @gs_cluster_sync_log_entry = gs_cluster_sync_log_entries(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:gs_cluster_sync_log_entries)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create gs_cluster_sync_log_entry" do
+ assert_difference('GsClusterSyncLogEntry.count') do
+ post :create, gs_cluster_sync_log_entry: @gs_cluster_sync_log_entry.attributes
+ end
+
+ assert_redirected_to gs_cluster_sync_log_entry_path(assigns(:gs_cluster_sync_log_entry))
+ end
+
+ test "should show gs_cluster_sync_log_entry" do
+ get :show, id: @gs_cluster_sync_log_entry.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @gs_cluster_sync_log_entry.to_param
+ assert_response :success
+ end
+
+ test "should update gs_cluster_sync_log_entry" do
+ put :update, id: @gs_cluster_sync_log_entry.to_param, gs_cluster_sync_log_entry: @gs_cluster_sync_log_entry.attributes
+ assert_redirected_to gs_cluster_sync_log_entry_path(assigns(:gs_cluster_sync_log_entry))
+ end
+
+ test "should destroy gs_cluster_sync_log_entry" do
+ assert_difference('GsClusterSyncLogEntry.count', -1) do
+ delete :destroy, id: @gs_cluster_sync_log_entry.to_param
+ end
+
+ assert_redirected_to gs_cluster_sync_log_entries_path
+ end
+end
diff --git a/test/functional/gs_nodes_controller_test.rb b/test/functional/gs_nodes_controller_test.rb
new file mode 100644
index 0000000..f5349ed
--- /dev/null
+++ b/test/functional/gs_nodes_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class GsNodesControllerTest < ActionController::TestCase
+ setup do
+ @gs_node = gs_nodes(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:gs_nodes)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create gs_node" do
+ assert_difference('GsNode.count') do
+ post :create, gs_node: @gs_node.attributes
+ end
+
+ assert_redirected_to gs_node_path(assigns(:gs_node))
+ end
+
+ test "should show gs_node" do
+ get :show, id: @gs_node.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @gs_node.to_param
+ assert_response :success
+ end
+
+ test "should update gs_node" do
+ put :update, id: @gs_node.to_param, gs_node: @gs_node.attributes
+ assert_redirected_to gs_node_path(assigns(:gs_node))
+ end
+
+ test "should destroy gs_node" do
+ assert_difference('GsNode.count', -1) do
+ delete :destroy, id: @gs_node.to_param
+ end
+
+ assert_redirected_to gs_nodes_path
+ end
+end
diff --git a/test/functional/gui_functions_controller_test.rb b/test/functional/gui_functions_controller_test.rb
new file mode 100644
index 0000000..9a6326f
--- /dev/null
+++ b/test/functional/gui_functions_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class GuiFunctionsControllerTest < ActionController::TestCase
+ setup do
+ @gui_function = gui_functions(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:gui_functions)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create gui_function" do
+ assert_difference('GuiFunction.count') do
+ post :create, gui_function: @gui_function.attributes
+ end
+
+ assert_redirected_to gui_function_path(assigns(:gui_function))
+ end
+
+ test "should show gui_function" do
+ get :show, id: @gui_function.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @gui_function.to_param
+ assert_response :success
+ end
+
+ test "should update gui_function" do
+ put :update, id: @gui_function.to_param, gui_function: @gui_function.attributes
+ assert_redirected_to gui_function_path(assigns(:gui_function))
+ end
+
+ test "should destroy gui_function" do
+ assert_difference('GuiFunction.count', -1) do
+ delete :destroy, id: @gui_function.to_param
+ end
+
+ assert_redirected_to gui_functions_path
+ end
+end
diff --git a/test/functional/hunt_group_members_controller_test.rb b/test/functional/hunt_group_members_controller_test.rb
new file mode 100644
index 0000000..9830c99
--- /dev/null
+++ b/test/functional/hunt_group_members_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class HuntGroupMembersControllerTest < ActionController::TestCase
+ setup do
+ @hunt_group_member = hunt_group_members(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:hunt_group_members)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create hunt_group_member" do
+ assert_difference('HuntGroupMember.count') do
+ post :create, hunt_group_member: @hunt_group_member.attributes
+ end
+
+ assert_redirected_to hunt_group_member_path(assigns(:hunt_group_member))
+ end
+
+ test "should show hunt_group_member" do
+ get :show, id: @hunt_group_member.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @hunt_group_member.to_param
+ assert_response :success
+ end
+
+ test "should update hunt_group_member" do
+ put :update, id: @hunt_group_member.to_param, hunt_group_member: @hunt_group_member.attributes
+ assert_redirected_to hunt_group_member_path(assigns(:hunt_group_member))
+ end
+
+ test "should destroy hunt_group_member" do
+ assert_difference('HuntGroupMember.count', -1) do
+ delete :destroy, id: @hunt_group_member.to_param
+ end
+
+ assert_redirected_to hunt_group_members_path
+ end
+end
diff --git a/test/functional/hunt_groups_controller_test.rb b/test/functional/hunt_groups_controller_test.rb
new file mode 100644
index 0000000..0234e12
--- /dev/null
+++ b/test/functional/hunt_groups_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class HuntGroupsControllerTest < ActionController::TestCase
+ setup do
+ @hunt_group = hunt_groups(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:hunt_groups)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create hunt_group" do
+ assert_difference('HuntGroup.count') do
+ post :create, hunt_group: @hunt_group.attributes
+ end
+
+ assert_redirected_to hunt_group_path(assigns(:hunt_group))
+ end
+
+ test "should show hunt_group" do
+ get :show, id: @hunt_group.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @hunt_group.to_param
+ assert_response :success
+ end
+
+ test "should update hunt_group" do
+ put :update, id: @hunt_group.to_param, hunt_group: @hunt_group.attributes
+ assert_redirected_to hunt_group_path(assigns(:hunt_group))
+ end
+
+ test "should destroy hunt_group" do
+ assert_difference('HuntGroup.count', -1) do
+ delete :destroy, id: @hunt_group.to_param
+ end
+
+ assert_redirected_to hunt_groups_path
+ end
+end
diff --git a/test/functional/manufacturers_controller_test.rb b/test/functional/manufacturers_controller_test.rb
new file mode 100644
index 0000000..dad38e5
--- /dev/null
+++ b/test/functional/manufacturers_controller_test.rb
@@ -0,0 +1,77 @@
+require 'test_helper'
+
+class ManufacturersControllerTest < ActionController::TestCase
+ setup do
+ @tenant = Factory.create(:tenant)
+ @user = Factory.create(:user)
+
+ @tenant.tenant_memberships.create(:user_id => @user.id)
+
+ @user.update_attributes!(:current_tenant_id => @tenant.id)
+
+ @manufacturer = Factory.create(:manufacturer)
+
+ @expected_status_if_not_authorized = :redirect
+ end
+
+ test "should not do anything for a normal user" do
+ session[:user_id] = @user.id
+ get :index
+ assert_response :redirect
+
+ get :new
+ assert_response :redirect
+
+ get :show, id: @manufacturer.to_param
+ assert_response :redirect
+
+ get :edit, id: @manufacturer.to_param
+ assert_response :redirect
+ end
+
+ # Maybe some sort of SuperUser Group should have access.
+ # Needs some more thinking.
+ #
+ # test "should get index" do
+ # session[:user_id] = @user.id
+ # get :index
+ # assert_response :success
+ # assert_not_nil assigns(:manufacturers)
+ # end
+ #
+ # test "should get new" do
+ # get :new
+ # assert_response :success
+ # end
+ #
+ # test "should create manufacturer" do
+ # assert_difference('Manufacturer.count') do
+ # post :create, manufacturer: Factory.build(:manufacturer).attributes
+ # end
+ #
+ # assert_redirected_to manufacturer_path(assigns(:manufacturer))
+ # end
+ #
+ # test "should show manufacturer" do
+ # get :show, id: @manufacturer.to_param
+ # assert_response :success
+ # end
+ #
+ # test "should get edit" do
+ # get :edit, id: @manufacturer.to_param
+ # assert_response :success
+ # end
+ #
+ # test "should update manufacturer" do
+ # put :update, id: @manufacturer.to_param, manufacturer: @manufacturer.attributes
+ # assert_redirected_to manufacturer_path(assigns(:manufacturer))
+ # end
+ #
+ # test "should destroy manufacturer" do
+ # assert_difference('Manufacturer.count', -1) do
+ # delete :destroy, id: @manufacturer.to_param
+ # end
+ #
+ # assert_redirected_to manufacturers_path
+ # end
+end
diff --git a/test/functional/notifications_test.rb b/test/functional/notifications_test.rb
new file mode 100644
index 0000000..d84bda2
--- /dev/null
+++ b/test/functional/notifications_test.rb
@@ -0,0 +1,12 @@
+require 'test_helper'
+
+class NotificationsTest < ActionMailer::TestCase
+ test "new_pin" do
+ mail = Notifications.new_pin
+ assert_equal "New pin", mail.subject
+ assert_equal ["to@example.org"], mail.to
+ assert_equal ["from@example.com"], mail.from
+ assert_match "Hi", mail.body.encoded
+ end
+
+end
diff --git a/test/functional/page_controller_test.rb b/test/functional/page_controller_test.rb
new file mode 100644
index 0000000..a5ae5ad
--- /dev/null
+++ b/test/functional/page_controller_test.rb
@@ -0,0 +1,35 @@
+require 'test_helper'
+
+class PageControllerTest < ActionController::TestCase
+
+ #test "on a fresh system you should not get index but be redirected to the setup wizard" do
+ test "should be redirected to setup wizard on a fresh system" do
+ session[:user_id] = nil
+ get :index
+ assert_redirected_to wizards_new_initial_setup_path
+ end
+
+
+ test "a logged in user should get index" do
+ @tenant = Factory.create(:tenant)
+ @user = Factory.create(:user)
+
+ @tenant.users << @user
+
+ session[:user_id] = @user.id
+ get :index
+ assert_response :success
+ end
+
+ test "a logged out user should be redirected to the login" do
+ @tenant = Factory.create(:tenant)
+ @user = Factory.create(:user)
+
+ @tenant.users << @user
+
+ session[:user_id] = nil
+ get :index
+ assert_redirected_to log_in_path
+ end
+
+end
diff --git a/test/functional/phone_book_entries_controller_test.rb b/test/functional/phone_book_entries_controller_test.rb
new file mode 100644
index 0000000..81c5b61
--- /dev/null
+++ b/test/functional/phone_book_entries_controller_test.rb
@@ -0,0 +1,103 @@
+require 'test_helper'
+
+class PhoneBookEntriesControllerTest < ActionController::TestCase
+
+ setup do
+ @user1 = Factory.create(:user)
+ pb = @user1.phone_books.first
+ @user1_phone_book_entry = Factory.create(
+ :phone_book_entry,
+ :phone_book_id => pb.id
+ )
+
+ @expected_status_if_not_authorized = :redirect
+ end
+
+ test "should not get index (not logged in)" do
+ get :index
+ assert_response @expected_status_if_not_authorized
+ end
+
+ test "should get index" do
+ session[:user_id] = @user1.id
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:phone_book_entries)
+ end
+
+
+# test "should get new" do
+# get :new
+# assert_response :success
+# end
+
+ test "should not have a route for new" do
+ assert_raises(ActionController::RoutingError) {
+ get :new
+ }
+ end
+
+#
+# test "should create phone_book_entry" do
+# assert_difference('PhoneBookEntry.count') do
+# post :create, phone_book_entry: @user1_phone_book_entry.attributes
+# end
+#
+# assert_redirected_to phone_book_entry_path(assigns(:phone_book_entry))
+# end
+#
+ test "should not show phone_book_entry (not logged in)" do
+ get :show, id: @user1_phone_book_entry.to_param
+ assert_response @expected_status_if_not_authorized
+ end
+
+ test "should show phone_book_entry without nesting" do
+ session[:user_id] = @user1.id
+ get :show, id: @user1_phone_book_entry.to_param
+ assert_response :success
+ end
+
+ test "should show phone_book_entry nested in phone_book" do
+ session[:user_id] = @user1.id
+ get :show, phone_book_id: @user1_phone_book_entry.phone_book.id, id: @user1_phone_book_entry.to_param
+ assert_response :success
+ end
+#
+# test "should get edit" do
+# get :edit, id: @user1_phone_book_entry.to_param
+# assert_response :success
+# end
+
+ test "should not have a route for edit" do
+ assert_raises(ActionController::RoutingError) {
+ get :edit, id: @user1_phone_book_entry.to_param
+ }
+ end
+
+#
+# test "should update phone_book_entry" do
+# put :update, id: @user1_phone_book_entry.to_param, phone_book_entry: @user1_phone_book_entry.attributes
+# assert_redirected_to phone_book_entry_path(assigns(:phone_book_entry))
+# end
+
+ test "should not have a route for update" do
+ assert_raises(ActionController::RoutingError) {
+ put :update, id: @user1_phone_book_entry.to_param, phone_book_entry: @user1_phone_book_entry.attributes
+ }
+ end
+
+#
+# test "should destroy phone_book_entry" do
+# assert_difference('PhoneBookEntry.count', -1) do
+# delete :destroy, id: @user1_phone_book_entry.to_param
+# end
+# assert_redirected_to phone_book_entries_path
+# end
+
+ test "should not have a route for destroy" do
+ assert_raises(ActionController::RoutingError) {
+ delete :destroy, id: @user1_phone_book_entry.to_param
+ }
+ end
+
+end
diff --git a/test/functional/phone_books_controller_test.rb b/test/functional/phone_books_controller_test.rb
new file mode 100644
index 0000000..a00f597
--- /dev/null
+++ b/test/functional/phone_books_controller_test.rb
@@ -0,0 +1,71 @@
+require 'test_helper'
+
+class PhoneBooksControllerTest < ActionController::TestCase
+ setup do
+ @tenant = Factory.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)
+
+ @tenant.users << @user
+ @users.users << @user
+
+ @personal_phone_book = Factory.create(:phone_book,
+ :phone_bookable_type => @user.class.to_s,
+ :phone_bookable_id => @user.id
+ )
+ phone_book_entry = Factory.create(:phone_book_entry)
+ @personal_phone_book.phone_book_entries << phone_book_entry
+
+ @expected_status_if_not_authorized = :redirect
+
+ session[:user_id] = @user.id
+ end
+
+ test "should get index" do
+ get :index, user_id: @user.id
+ assert_response :success
+ assert_not_nil assigns(:phone_books)
+ end
+
+ test "should get new" do
+ get :new, user_id: @user.id
+ assert_response :success
+ end
+
+ test "should create phone_book" do
+ phone_book2 = Factory.build(:phone_book,
+ :phone_bookable_type => @user.class.to_s,
+ :phone_bookable_id => @user.id
+ )
+ assert_difference('PhoneBook.count') do
+ post :create, phone_book: phone_book2.attributes, user_id: @user.id
+ end
+ assert_redirected_to( user_phone_book_path( @user, assigns(:phone_book)))
+ end
+
+ test "should show phone_book" do
+ get :show, id: @personal_phone_book.to_param, user_id: @user.id
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @personal_phone_book.to_param, user_id: @user.id
+ assert_response :success
+ end
+
+ test "should update phone_book" do
+ put :update, id: @personal_phone_book.to_param, phone_book: @personal_phone_book.attributes, user_id: @user.id
+ assert_redirected_to( user_phone_book_path(@user, assigns(:phone_book)))
+ end
+
+ # TODO: Fix this test
+ #
+ # test "should destroy phone_book" do
+ # assert_difference('PhoneBook.count', -1) do
+ # delete :destroy, id: @personal_phone_book.to_param, user_id: @user.id
+ # end
+ # assert_redirected_to( user_phone_books_path( @user ))
+ # end
+
+end
diff --git a/test/functional/phone_models_controller_test.rb b/test/functional/phone_models_controller_test.rb
new file mode 100644
index 0000000..2d1a87a
--- /dev/null
+++ b/test/functional/phone_models_controller_test.rb
@@ -0,0 +1,143 @@
+require 'test_helper'
+
+class PhoneModelsControllerTest < ActionController::TestCase
+
+ setup do
+ # Create a tenant:
+ @tenant = Factory.create(:tenant)
+
+ # Create a User who is member of the Tenant but has no special rights:
+ @user = Factory.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)
+ @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)
+ end
+
+ [ '@user.id', '' ].each do |user_id_code|
+ # Note: Do *not* actually create the user outside of tests.
+
+ explanation = user_id_code.blank? ?
+ "if not logged in" :
+ "if logged in as an ordinary user"
+
+ test "should not get index #{explanation}" do
+ session[:user_id] = eval( user_id_code )
+ get :index, manufacturer_id: @phone_model.manufacturer_id
+ assert_response :redirect
+ end
+
+ test "should not get new #{explanation}" do
+ session[:user_id] = eval( user_id_code )
+ get :new, manufacturer_id: @phone_model.manufacturer_id
+ assert_response :redirect
+ end
+
+ test "should not create phone_model #{explanation}" do
+ 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,
+ :manufacturer_id => @phone_model.manufacturer_id).attributes
+ end
+ end
+
+ test "should not show phone_model #{explanation}" do
+ session[:user_id] = eval( user_id_code )
+ get :show, manufacturer_id: @phone_model.manufacturer_id, id: @phone_model.to_param
+ assert_response :redirect
+ end
+
+ test "should not get edit #{explanation}" do
+ session[:user_id] = eval( user_id_code )
+ get :edit, manufacturer_id: @phone_model.manufacturer_id, id: @phone_model.to_param
+ assert_response :redirect
+ end
+
+ test "should not update phone_model #{explanation}" do
+ session[:user_id] = eval( user_id_code )
+
+ # save the old name:
+ old_name = PhoneModel.find(@phone_model.id).name
+ # try to make an update:
+ put :update, manufacturer_id: @phone_model.manufacturer_id, id: @phone_model.to_param, phone_model: @phone_model.attributes.merge({
+ 'name' => @phone_model.name.reverse
+ })
+ # check that the update didn't work:
+ assert_equal old_name, PhoneModel.find(@phone_model.id).name
+
+ assert_response :redirect
+ end
+
+ test "should not destroy phone_model #{explanation}" do
+ session[:user_id] = eval( user_id_code )
+
+ assert_no_difference('PhoneModel.count') do
+ delete :destroy, manufacturer_id: @phone_model.manufacturer_id, id: @phone_model.to_param
+ end
+ assert_response :redirect
+ end
+
+ end
+
+
+ test "should get index as super admin" do
+ session[:user_id] = @super_admin.id
+ get :index, manufacturer_id: @phone_model.manufacturer_id
+ assert_response :success
+ assert_not_nil assigns(:phone_models)
+ end
+
+ test "should get new as super admin" do
+ session[:user_id] = @super_admin.id
+ get :new, manufacturer_id: @phone_model.manufacturer_id
+ assert_response :success
+ end
+
+
+ # # We don't have access to manufacturer_id. We'll need to
+ # # 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,
+ # :manufacturer_id => @phone_model.manufacturer_id).attributes
+ # end
+ #
+ # assert_redirected_to manufacturer_phone_model_path( @phone_model.manufacturer_id, assigns(:phone_model))
+ # end
+
+ test "should show phone_model as super admin" do
+ session[:user_id] = @super_admin.id
+ get :show, manufacturer_id: @phone_model.manufacturer_id, id: @phone_model.to_param
+ assert_response :success
+ end
+
+ test "should get edit as super admin" do
+ session[:user_id] = @super_admin.id
+ get :edit, manufacturer_id: @phone_model.manufacturer_id, id: @phone_model.to_param
+ assert_response :success
+ end
+
+ test "should update phone_model as super admin" do
+ session[:user_id] = @super_admin.id
+ put :update, manufacturer_id: @phone_model.manufacturer_id, id: @phone_model.to_param, phone_model: @phone_model.attributes
+ assert_redirected_to manufacturer_phone_model_path( @phone_model.manufacturer_id, assigns(:phone_model))
+ end
+
+ test "should destroy phone_model as super admin" do
+ session[:user_id] = @super_admin.id
+ assert_difference('PhoneModel.count', -1) do
+ delete :destroy, manufacturer_id: @phone_model.manufacturer_id, id: @phone_model.to_param
+ end
+
+ assert_redirected_to manufacturer_phone_models_path( @phone_model.manufacturer_id )
+ end
+
+end
diff --git a/test/functional/phone_number_ranges_controller_test.rb b/test/functional/phone_number_ranges_controller_test.rb
new file mode 100644
index 0000000..39f28c4
--- /dev/null
+++ b/test/functional/phone_number_ranges_controller_test.rb
@@ -0,0 +1,78 @@
+require 'test_helper'
+
+class PhoneNumberRangesControllerTest < ActionController::TestCase
+
+ #TODO Uncomment tests once the views are implemented.
+
+ setup do
+ @phone_number_range = Factory.create(:phone_number_range)
+ end
+
+ test "should get index" do
+ get :index,
+ :"#{@phone_number_range.phone_number_rangeable_type.underscore}_id" => @phone_number_range.phone_number_rangeable.try(:to_param)
+ assert_response :success
+ assert_not_nil assigns(:phone_number_ranges)
+ end
+
+# test "should get new" do
+# get :new,
+# :"#{@phone_number_range.phone_number_rangeable_type.underscore}_id" => @phone_number_range.phone_number_rangeable.try(:to_param)
+# assert_response :success
+# end
+
+# test "should create phone_number_range" do
+# assert_difference('PhoneNumberRange.count') do
+# post :create,
+# :"#{@phone_number_range.phone_number_rangeable_type.underscore}_id" => @phone_number_range.phone_number_rangeable.try(:to_param),
+# :phone_number_range => @phone_number_range.attributes
+# end
+# assert_redirected_to(
+# method( :"#{@phone_number_range.phone_number_rangeable_type.underscore}_phone_number_range_path" ).(
+# @phone_number_range.phone_number_rangeable,
+# @phone_number_range
+# )
+# )
+# end
+
+# test "should show phone_number_range" do
+# get :show,
+# :"#{@phone_number_range.phone_number_rangeable_type.underscore}_id" => @phone_number_range.phone_number_rangeable.try(:to_param),
+# :id => @phone_number_range.to_param
+# assert_response :success
+# end
+
+# test "should get edit" do
+# get :edit,
+# :"#{@phone_number_range.phone_number_rangeable_type.underscore}_id" => @phone_number_range.phone_number_rangeable.try(:to_param),
+# :id => @phone_number_range.to_param
+# assert_response :success
+# end
+
+ test "should update phone_number_range" do
+ put :update,
+ :"#{@phone_number_range.phone_number_rangeable_type.underscore}_id" => @phone_number_range.phone_number_rangeable.try(:to_param),
+ :id => @phone_number_range.to_param,
+ :phone_number_range => @phone_number_range.attributes
+# assert_redirected_to(
+# method( :"#{@phone_number_range.phone_number_rangeable_type.underscore}_phone_number_range_path" ).(
+# @phone_number_range.phone_number_rangeable,
+# @phone_number_range
+# )
+# )
+ end
+
+# test "should destroy phone_number_range" do
+# assert_difference('PhoneNumberRange.count', -1) do
+# delete :destroy,
+# :"#{@phone_number_range.phone_number_rangeable_type.underscore}_id" => @phone_number_range.phone_number_rangeable.try(:to_param),
+# :id => @phone_number_range.to_param
+# end
+# assert_redirected_to(
+# method( :"#{@phone_number_range.phone_number_rangeable_type.underscore}_phone_number_ranges_path" ).(
+# @phone_number_range.phone_number_rangeable
+# )
+# )
+# end
+
+end
diff --git a/test/functional/phone_numbers_controller_test.rb b/test/functional/phone_numbers_controller_test.rb
new file mode 100644
index 0000000..ab0a4b2
--- /dev/null
+++ b/test/functional/phone_numbers_controller_test.rb
@@ -0,0 +1,115 @@
+require 'test_helper'
+
+class PhoneNumbersControllerTest < ActionController::TestCase
+
+ setup do
+ @tenant = Factory.create(:tenant)
+ @user = Factory.create(:user)
+
+ @tenant.tenant_memberships.create(:user_id => @user.id)
+
+ @user.update_attributes!(:current_tenant_id => @tenant.id)
+
+ @private_phone_book = @user.phone_books.first
+
+ @private_phone_book_entry = Factory.create(
+ :phone_book_entry,
+ :phone_book => @private_phone_book
+ )
+ @phone_number = Factory.create(
+ :phone_number,
+ :phone_numberable => @private_phone_book_entry
+ )
+
+ @expected_status_if_not_authorized = :redirect
+ end
+
+
+ test "should get index" do
+ session[:user_id] = @user.id
+ get :index, phone_book_entry_id: @private_phone_book_entry.id
+ assert_response :success
+ assert_not_nil assigns(:phone_numbers)
+ end
+
+ test "should not get index (not logged in)" do
+ get :index, phone_book_entry_id: @private_phone_book_entry.id
+ assert_response @expected_status_if_not_authorized
+ end
+
+ test "should get new" do
+ session[:user_id] = @user.id
+ get :new, phone_book_entry_id: @private_phone_book_entry.id
+ assert_response :success
+ end
+
+ # test "should not get new (not logged in)" do
+ # get :new, phone_book_entry_id: @private_phone_book_entry.id
+ # assert_response @expected_status_if_not_authorized
+ # end
+
+ # test "should create phone_number" do
+ # session[:user_id] = @user.id
+ # assert_difference('PhoneNumber.count') do
+ # post :create, phone_book_entry_id: @private_phone_book_entry.id, phone_number: @phone_number.attributes
+ # end
+ # assert_redirected_to( phone_book_entry_phone_number_path( assigns(:phone_number)))
+ # end
+ #
+ # test "should not create phone_number (not logged in)" do
+ # assert_no_difference('PhoneNumber.count') do
+ # post :create, phone_book_entry_id: @private_phone_book_entry.id, phone_number: @phone_number.attributes
+ # end
+ # assert_response @expected_status_if_not_authorized
+ # end
+
+ test "should show phone_number" do
+ session[:user_id] = @user.id
+ get :show, phone_book_entry_id: @private_phone_book_entry.id, id: @phone_number.to_param
+ assert_response :success
+ end
+
+ test "should not show phone_number (not logged in)" do
+ get :show, phone_book_entry_id: @private_phone_book_entry.id, id: @phone_number.to_param
+ assert_response @expected_status_if_not_authorized
+ end
+
+
+ test "should get edit" do
+ session[:user_id] = @user.id
+ get :edit, phone_book_entry_id: @private_phone_book_entry.id, id: @phone_number.to_param
+ assert_response :success
+ end
+
+ test "should not get edit (not logged in)" do
+ get :edit, phone_book_entry_id: @private_phone_book_entry.id, id: @phone_number.to_param
+ assert_response @expected_status_if_not_authorized
+ end
+
+ test "should update phone_number" do
+ session[:user_id] = @user.id
+ put :update, phone_book_entry_id: @private_phone_book_entry.id, id: @phone_number.to_param, phone_number: @phone_number.attributes
+ assert_redirected_to( phone_book_entry_phone_number_path( assigns(:phone_number)))
+ end
+
+ test "should not update phone_number (not logged in)" do
+ put :update, phone_book_entry_id: @private_phone_book_entry.id, id: @phone_number.to_param, phone_number: @phone_number.attributes
+ assert_response @expected_status_if_not_authorized
+ end
+
+ test "should destroy phone_number" do
+ session[:user_id] = @user.id
+ assert_difference('PhoneNumber.count', -1) do
+ delete :destroy, phone_book_entry_id: @private_phone_book_entry.id, id: @phone_number.to_param
+ end
+ assert_redirected_to( phone_book_entry_phone_numbers_path() )
+ end
+
+ test "should not destroy phone_number (not logged in)" do
+ assert_no_difference('PhoneNumber.count') do
+ delete :destroy, phone_book_entry_id: @private_phone_book_entry.id, id: @phone_number.to_param
+ end
+ assert_response @expected_status_if_not_authorized
+ end
+
+end
diff --git a/test/functional/phone_sip_accounts_controller_test.rb b/test/functional/phone_sip_accounts_controller_test.rb
new file mode 100644
index 0000000..37a3219
--- /dev/null
+++ b/test/functional/phone_sip_accounts_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class PhoneSipAccountsControllerTest < ActionController::TestCase
+ setup do
+ @phone_sip_account = phone_sip_accounts(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:phone_sip_accounts)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create phone_sip_account" do
+ assert_difference('PhoneSipAccount.count') do
+ post :create, phone_sip_account: @phone_sip_account.attributes
+ end
+
+ assert_redirected_to phone_sip_account_path(assigns(:phone_sip_account))
+ end
+
+ test "should show phone_sip_account" do
+ get :show, id: @phone_sip_account.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @phone_sip_account.to_param
+ assert_response :success
+ end
+
+ test "should update phone_sip_account" do
+ put :update, id: @phone_sip_account.to_param, phone_sip_account: @phone_sip_account.attributes
+ assert_redirected_to phone_sip_account_path(assigns(:phone_sip_account))
+ end
+
+ test "should destroy phone_sip_account" do
+ assert_difference('PhoneSipAccount.count', -1) do
+ delete :destroy, id: @phone_sip_account.to_param
+ end
+
+ assert_redirected_to phone_sip_accounts_path
+ end
+end
diff --git a/test/functional/phones_controller_test.rb b/test/functional/phones_controller_test.rb
new file mode 100644
index 0000000..1b0aa55
--- /dev/null
+++ b/test/functional/phones_controller_test.rb
@@ -0,0 +1,55 @@
+require 'test_helper'
+
+class PhonesControllerTest < ActionController::TestCase
+ # TODO nil und normaler User duerfen nichts.
+
+ #TODO Uncomment tests once the route has been implemented.
+
+# setup do
+# @phone = Factory.create(:phone)
+# end
+#
+# test "should get index" do
+# get :index
+# assert_response :success
+# assert_not_nil assigns(:phones)
+# end
+#
+# test "should get new" do
+# get :new
+# assert_response :success
+# end
+#
+# # Would have to be a nested route to work.
+# #
+# # test "should create phone" do
+# # assert_difference('Phone.count') do
+# # post :create, phone: Factory.build(:phone, :phone_model_id => @phone.phone_model_id).attributes
+# # end
+# #
+# # assert_redirected_to phone_path(assigns(:phone))
+# # end
+#
+# test "should show phone" do
+# get :show, id: @phone.to_param
+# assert_response :success
+# end
+#
+# test "should get edit" do
+# get :edit, id: @phone.to_param
+# assert_response :success
+# end
+#
+# test "should update phone" do
+# put :update, id: @phone.to_param, phone: @phone.attributes
+# assert_redirected_to phone_path(assigns(:phone))
+# end
+#
+# test "should destroy phone" do
+# assert_difference('Phone.count', -1) do
+# delete :destroy, id: @phone.to_param
+# end
+#
+# assert_redirected_to phones_path
+# end
+end
diff --git a/test/functional/phones_sip_accounts_controller_test.rb b/test/functional/phones_sip_accounts_controller_test.rb
new file mode 100644
index 0000000..967b8fe
--- /dev/null
+++ b/test/functional/phones_sip_accounts_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class PhonesSipAccountsControllerTest < ActionController::TestCase
+
+ setup do
+ @phones_sip_account = Factory.create(:phones_sip_account)
+ end
+
+# test "should get index" do
+# get :index
+# assert_response :success
+# assert_not_nil assigns(:phones_sip_accounts)
+# end
+#
+# test "should get new" do
+# get :new
+# assert_response :success
+# end
+#
+# test "should create phones_sip_account" do
+# assert_difference('PhonesSipAccount.count') do
+# post :create, phones_sip_account: @phones_sip_account.attributes
+# end
+# assert_redirected_to phones_sip_account_path(assigns(:phones_sip_account))
+# end
+#
+# test "should show phones_sip_account" do
+# get :show, id: @phones_sip_account.to_param
+# assert_response :success
+# end
+#
+# test "should get edit" do
+# get :edit, id: @phones_sip_account.to_param
+# assert_response :success
+# end
+#
+# test "should update phones_sip_account" do
+# put :update, id: @phones_sip_account.to_param, phones_sip_account: @phones_sip_account.attributes
+# assert_redirected_to phones_sip_account_path(assigns(:phones_sip_account))
+# end
+#
+# test "should destroy phones_sip_account" do
+# assert_difference('PhonesSipAccount.count', -1) do
+# delete :destroy, id: @phones_sip_account.to_param
+# end
+# assert_redirected_to phones_sip_accounts_path
+# end
+
+end
diff --git a/test/functional/ringtones_controller_test.rb b/test/functional/ringtones_controller_test.rb
new file mode 100644
index 0000000..f0f04f6
--- /dev/null
+++ b/test/functional/ringtones_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class RingtonesControllerTest < ActionController::TestCase
+ setup do
+ @ringtone = ringtones(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:ringtones)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create ringtone" do
+ assert_difference('Ringtone.count') do
+ post :create, ringtone: @ringtone.attributes
+ end
+
+ assert_redirected_to ringtone_path(assigns(:ringtone))
+ end
+
+ test "should show ringtone" do
+ get :show, id: @ringtone.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @ringtone.to_param
+ assert_response :success
+ end
+
+ test "should update ringtone" do
+ put :update, id: @ringtone.to_param, ringtone: @ringtone.attributes
+ assert_redirected_to ringtone_path(assigns(:ringtone))
+ end
+
+ test "should destroy ringtone" do
+ assert_difference('Ringtone.count', -1) do
+ delete :destroy, id: @ringtone.to_param
+ end
+
+ assert_redirected_to ringtones_path
+ end
+end
diff --git a/test/functional/sessions_controller_test.rb b/test/functional/sessions_controller_test.rb
new file mode 100644
index 0000000..d30ebc3
--- /dev/null
+++ b/test/functional/sessions_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class SessionsControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/functional/sip_accounts_controller_test.rb b/test/functional/sip_accounts_controller_test.rb
new file mode 100644
index 0000000..5c97dd2
--- /dev/null
+++ b/test/functional/sip_accounts_controller_test.rb
@@ -0,0 +1,76 @@
+require 'test_helper'
+
+class SipAccountsControllerTest < ActionController::TestCase
+
+ setup do
+ @tenant = Factory.create(:tenant)
+ @user = Factory.create(:user)
+ @tenant.tenant_memberships.create(:user_id => @user.id)
+ @sip_account = @user.sip_accounts.create( Factory.build(:sip_account).attributes )
+
+ @parent_param = @sip_account.sip_accountable_type.foreign_key.to_sym
+ @parent_id = @sip_account.sip_accountable.id
+ end
+
+ test "should get index" do
+ session[:user_id] = @user.id
+ get :index,
+ @parent_param => @parent_id
+ assert_response :success
+ assert_not_nil assigns(:sip_accounts)
+ end
+
+ test "should get new" do
+ session[:user_id] = @user.id
+ get :new,
+ @parent_param => @parent_id
+ assert_response :success
+ end
+
+ test "should create sip_account" do
+ session[:user_id] = @user.id
+ assert_difference('SipAccount.count') do
+ post :create,
+ @parent_param => @parent_id,
+ sip_account: Factory.attributes_for(:sip_account)
+ end
+ end
+
+ test "should show sip_account" do
+ session[:user_id] = @user.id
+ get :show,
+ @parent_param => @parent_id,
+ id: @sip_account.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ session[:user_id] = @user.id
+ get :edit,
+ @parent_param => @parent_id,
+ id: @sip_account.to_param
+ assert_response :success
+ end
+
+ test "should update sip_account" do
+ session[:user_id] = @user.id
+ put :update,
+ @parent_param => @parent_id,
+ id: @sip_account.to_param,
+ sip_account: @sip_account.attributes
+ # TODO Find the right redirect/answer.
+ #assert_redirected_to method( :"#{@sip_account.sip_accountable_type.underscore}_sip_account_path" ).( @sip_account.sip_accountable, @sip_account )
+ end
+
+ test "should destroy sip_account" do
+ session[:user_id] = @user.id
+ assert_difference('SipAccount.count', -1) do
+ delete :destroy,
+ @parent_param => @parent_id,
+ id: @sip_account.to_param
+ end
+ # TODO Find the right redirect/answer.
+ #assert_redirected_to method( :"#{@sip_account.sip_accountable_type.underscore}_sip_accounts_path" ).( @sip_account.sip_accountable )
+ end
+
+end
diff --git a/test/functional/sip_domains_controller_test.rb b/test/functional/sip_domains_controller_test.rb
new file mode 100644
index 0000000..f26ea02
--- /dev/null
+++ b/test/functional/sip_domains_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class SipDomainsControllerTest < ActionController::TestCase
+ setup do
+ @sip_domain = Factory.create(:sip_domain)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:sip_domains)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create sip_domain" do
+ assert_difference('SipDomain.count') do
+ post :create, sip_domain: Factory.build(:sip_domain).attributes
+ end
+
+ assert_redirected_to sip_domain_path(assigns(:sip_domain))
+ end
+
+ test "should show sip_domain" do
+ get :show, id: @sip_domain.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @sip_domain.to_param
+ assert_response :success
+ end
+
+ test "should update sip_domain" do
+ put :update, id: @sip_domain.to_param, sip_domain: @sip_domain.attributes
+ assert_redirected_to sip_domain_path(assigns(:sip_domain))
+ end
+
+ test "should destroy sip_domain" do
+ assert_difference('SipDomain.count', -1) do
+ delete :destroy, id: @sip_domain.to_param
+ end
+
+ assert_redirected_to sip_domains_path
+ end
+end
diff --git a/test/functional/softkeys_controller_test.rb b/test/functional/softkeys_controller_test.rb
new file mode 100644
index 0000000..6eed165
--- /dev/null
+++ b/test/functional/softkeys_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class SoftkeysControllerTest < ActionController::TestCase
+ setup do
+ @softkey = softkeys(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:softkeys)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create softkey" do
+ assert_difference('Softkey.count') do
+ post :create, softkey: @softkey.attributes
+ end
+
+ assert_redirected_to softkey_path(assigns(:softkey))
+ end
+
+ test "should show softkey" do
+ get :show, id: @softkey.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @softkey.to_param
+ assert_response :success
+ end
+
+ test "should update softkey" do
+ put :update, id: @softkey.to_param, softkey: @softkey.attributes
+ assert_redirected_to softkey_path(assigns(:softkey))
+ end
+
+ test "should destroy softkey" do
+ assert_difference('Softkey.count', -1) do
+ delete :destroy, id: @softkey.to_param
+ end
+
+ assert_redirected_to softkeys_path
+ end
+end
diff --git a/test/functional/system_messages_controller_test.rb b/test/functional/system_messages_controller_test.rb
new file mode 100644
index 0000000..2894cd3
--- /dev/null
+++ b/test/functional/system_messages_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class SystemMessagesControllerTest < ActionController::TestCase
+ setup do
+ @system_message = system_messages(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:system_messages)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create system_message" do
+ assert_difference('SystemMessage.count') do
+ post :create, system_message: @system_message.attributes
+ end
+
+ assert_redirected_to system_message_path(assigns(:system_message))
+ end
+
+ test "should show system_message" do
+ get :show, id: @system_message.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @system_message.to_param
+ assert_response :success
+ end
+
+ test "should update system_message" do
+ put :update, id: @system_message.to_param, system_message: @system_message.attributes
+ assert_redirected_to system_message_path(assigns(:system_message))
+ end
+
+ test "should destroy system_message" do
+ assert_difference('SystemMessage.count', -1) do
+ delete :destroy, id: @system_message.to_param
+ end
+
+ assert_redirected_to system_messages_path
+ end
+end
diff --git a/test/functional/tenants_controller_test.rb b/test/functional/tenants_controller_test.rb
new file mode 100644
index 0000000..b4e2df4
--- /dev/null
+++ b/test/functional/tenants_controller_test.rb
@@ -0,0 +1,51 @@
+require 'test_helper'
+
+class TenantsControllerTest < ActionController::TestCase
+ # TODO Create tests which test that a login user has specific rights.
+
+ # setup do
+ # @tenant = Factory.create(:tenant)
+ # end
+ #
+ # test "should get index" do
+ # get :index
+ # assert_response :success
+ # assert_not_nil assigns(:tenants)
+ # end
+ #
+ # test "should get new" do
+ # get :new
+ # assert_response :success
+ # end
+ #
+ # test "should create tenant" do
+ # assert_difference('Tenant.count') do
+ # post :create, tenant: Factory.build(:tenant).attributes
+ # end
+ #
+ # assert_redirected_to tenant_path(assigns(:tenant))
+ # end
+ #
+ # test "should show tenant" do
+ # get :show, id: @tenant.to_param
+ # assert_response :success
+ # end
+ #
+ # test "should get edit" do
+ # get :edit, id: @tenant.to_param
+ # assert_response :success
+ # end
+ #
+ # test "should update tenant" do
+ # put :update, id: @tenant.to_param, tenant: @tenant.attributes
+ # assert_redirected_to tenant_path(assigns(:tenant))
+ # end
+ #
+ # test "should destroy tenant" do
+ # assert_difference('Tenant.count', -1) do
+ # delete :destroy, id: @tenant.to_param
+ # end
+ #
+ # assert_redirected_to tenants_path
+ # end
+end
diff --git a/test/functional/user_groups_controller_test.rb b/test/functional/user_groups_controller_test.rb
new file mode 100644
index 0000000..0e39048
--- /dev/null
+++ b/test/functional/user_groups_controller_test.rb
@@ -0,0 +1,51 @@
+require 'test_helper'
+
+class UserGroupsControllerTest < ActionController::TestCase
+ # TODO Create tests which test that a login user has specific rights.
+
+ # setup do
+ # @user_group = Factory.create(:user_group)
+ # end
+ #
+ # test "should get index" do
+ # get :index
+ # assert_response :success
+ # assert_not_nil assigns(:user_groups)
+ # end
+ #
+ # test "should get new" do
+ # get :new
+ # assert_response :success
+ # end
+ #
+ # test "should create user_group" do
+ # assert_difference('UserGroup.count') do
+ # post :create, user_group: Factory.build(:user_group).attributes
+ # end
+ #
+ # assert_redirected_to user_group_path(assigns(:user_group))
+ # end
+ #
+ # test "should show user_group" do
+ # get :show, id: @user_group.to_param
+ # assert_response :success
+ # end
+ #
+ # test "should get edit" do
+ # get :edit, id: @user_group.to_param
+ # assert_response :success
+ # end
+ #
+ # test "should update user_group" do
+ # put :update, id: @user_group.to_param, user_group: @user_group.attributes
+ # assert_redirected_to user_group_path(assigns(:user_group))
+ # end
+ #
+ # test "should destroy user_group" do
+ # assert_difference('UserGroup.count', -1) do
+ # delete :destroy, id: @user_group.to_param
+ # end
+ #
+ # assert_redirected_to user_groups_path
+ # end
+end
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
new file mode 100644
index 0000000..d1898f7
--- /dev/null
+++ b/test/functional/users_controller_test.rb
@@ -0,0 +1,65 @@
+require 'test_helper'
+
+class UsersControllerTest < ActionController::TestCase
+ setup do
+ @tenant = Factory.create(:tenant)
+ @user = Factory.create(:user)
+
+ @tenant.tenant_memberships.create(:user_id => @user.id)
+
+ @user.update_attributes!(:current_tenant_id => @tenant.id)
+
+ @expected_status_if_not_authorized = :redirect
+ end
+
+ test "should get index" do
+ session[:user_id] = @user.id
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:users)
+ end
+
+ test "should get new" do
+ session[:user_id] = nil
+ get :new
+ assert_response :success
+ end
+
+ # TODO Fix Test
+ #
+ # test "should create user" do
+ # session[:user_id] = nil
+ # assert_difference('User.count') do
+ # post :create, user: Factory.build(:user).attributes
+ # end
+ #
+ # # assert_redirected_to user_path(assigns(:user))
+ # end
+
+ test "should show user" do
+ session[:user_id] = @user.id
+ get :show, id: @user.to_param
+ assert_response :success
+ end
+
+
+ test "should get edit" do
+ session[:user_id] = @user.id
+ get :edit, id: @user.to_param
+ assert_response :success
+ end
+
+ test "should update user" do
+ session[:user_id] = @user.id
+ put :update, id: @user.to_param, user: @user.attributes
+ assert_redirected_to user_path(assigns(:user))
+ end
+
+ test "should not destroy itself" do
+ assert_no_difference('User.count') do
+ delete :destroy, id: @user.to_param
+ end
+
+# assert_redirected_to users_path
+ end
+end
diff --git a/test/functional/whitelists_controller_test.rb b/test/functional/whitelists_controller_test.rb
new file mode 100644
index 0000000..842069f
--- /dev/null
+++ b/test/functional/whitelists_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class WhitelistsControllerTest < ActionController::TestCase
+ setup do
+ @whitelist = whitelists(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:whitelists)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create whitelist" do
+ assert_difference('Whitelist.count') do
+ post :create, whitelist: @whitelist.attributes
+ end
+
+ assert_redirected_to whitelist_path(assigns(:whitelist))
+ end
+
+ test "should show whitelist" do
+ get :show, id: @whitelist.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @whitelist.to_param
+ assert_response :success
+ end
+
+ test "should update whitelist" do
+ put :update, id: @whitelist.to_param, whitelist: @whitelist.attributes
+ assert_redirected_to whitelist_path(assigns(:whitelist))
+ end
+
+ test "should destroy whitelist" do
+ assert_difference('Whitelist.count', -1) do
+ delete :destroy, id: @whitelist.to_param
+ end
+
+ assert_redirected_to whitelists_path
+ end
+end