summaryrefslogtreecommitdiff
path: root/test/functional/manufacturers_controller_test.rb
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/manufacturers_controller_test.rb
parent3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff)
Start of GS5.
Diffstat (limited to 'test/functional/manufacturers_controller_test.rb')
-rw-r--r--test/functional/manufacturers_controller_test.rb77
1 files changed, 77 insertions, 0 deletions
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