blob: 0b10f6da6282cb3d210a1d333e0fe59958ef04b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
require 'test_helper'
class ManufacturersControllerTest < ActionController::TestCase
setup do
@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 = FactoryGirl.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: FactoryGirl.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
|