trust 0.8.3 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -1
- data/lib/trust.rb +9 -0
- data/lib/trust/authorization.rb +83 -36
- data/lib/trust/controller.rb +32 -8
- data/lib/trust/controller/properties.rb +12 -0
- data/lib/trust/controller/resource.rb +79 -11
- data/lib/trust/permissions.rb +177 -24
- data/lib/trust/version.rb +1 -1
- data/test/dummy/app/controllers/accounts_controller.rb +2 -2
- data/test/dummy/app/controllers/clients_controller.rb +1 -1
- data/test/dummy/app/controllers/mongo_accounts_controller.rb +5 -4
- data/test/dummy/app/controllers/mongo_clients_controller.rb +1 -1
- data/test/dummy/app/controllers/users_controller.rb +1 -5
- data/test/dummy/app/models/account.rb +1 -1
- data/test/dummy/app/models/client.rb +1 -1
- data/test/dummy/app/models/permissions.rb +18 -11
- data/test/dummy/app/models/user.rb +1 -1
- data/test/dummy/app/views/accounts/edit.html.erb +1 -1
- data/test/dummy/app/views/accounts/show.html.erb +1 -1
- data/test/dummy/app/views/mongo_accounts/_form.html.erb +1 -1
- data/test/dummy/app/views/mongo_accounts/edit.html.erb +2 -2
- data/test/dummy/app/views/mongo_accounts/index.html.erb +3 -3
- data/test/dummy/app/views/mongo_accounts/show.html.erb +2 -2
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +3 -34
- data/test/dummy/config/boot.rb +4 -9
- data/test/dummy/config/environment.rb +3 -3
- data/test/dummy/config/environments/development.rb +22 -18
- data/test/dummy/config/environments/production.rb +46 -34
- data/test/dummy/config/environments/test.rb +19 -14
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +6 -5
- data/test/dummy/config/initializers/mime_types.rb +0 -1
- data/test/dummy/config/initializers/session_store.rb +1 -6
- data/test/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/test/dummy/config/locales/en.yml +20 -2
- data/test/dummy/config/mongoid.yml +16 -18
- data/test/dummy/config/routes.rb +3 -3
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +30 -0
- data/test/dummy/log/test.log +6382 -0
- data/test/dummy/test/functional/accounts_controller_test.rb +2 -2
- data/test/dummy/test/functional/mongo_accounts_controller_test.rb +8 -8
- data/test/dummy/test/functional/mongo_clients_controller_test.rb +1 -1
- data/test/dummy/test/unit/permissions_test.rb +1 -1
- data/test/dummy/tmp/cache/assets/test/sprockets/0e74e8595d4c5c03160356ab9bf6f67c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/189460d2a0f63f35d55c384e0beb9cc4 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4050a4e5062ab95c9f32e9b6940821ea +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5f1a0d05e77ca8b9a1fc2a47e17a8174 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/75f67b2244ba6a4914d71df068f5fda9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/7ed0985e7e627ac5280078ee9c7078fe +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/86d19eda31629412e6817570ffde9a93 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/87b209c0c9da28094a8d5581a21262c6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/954318d0d3412eec67db5c2508ae5169 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/95c1a034126598a432130d7fc227c189 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/b55283b385e5692ecf1b59332bbc5a11 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/b678ce3482f77c68a19e697960645cb6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ca9d9c205bcfa05de1ddd180f8ecc168 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d36f675d4251ea3868635d299f3bb166 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f56253b5f374fff1a33fbbc9881c9124 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/fe1f20fb032685e2e1fcad23f0ad6601 +0 -0
- data/test/test_helper.rb +6 -2
- data/test/trust_test.rb +4 -0
- data/test/unit/trust/authorization_test.rb +165 -71
- data/test/unit/trust/controller/properties_test.rb +15 -0
- data/test/unit/trust/controller/resource_test.rb +29 -9
- data/test/unit/trust/controller_test.rb +53 -40
- data/test/unit/trust/permissions_test.rb +196 -69
- metadata +93 -28
@@ -63,7 +63,7 @@ class AccountsControllerTest < ActionController::TestCase
|
|
63
63
|
|
64
64
|
should "update account" do
|
65
65
|
put :update, client_id: @client, id: @account, account: { name: @account.name }
|
66
|
-
assert_redirected_to client_account_path(assigns(:account))
|
66
|
+
assert_redirected_to client_account_path(@client, assigns(:account))
|
67
67
|
end
|
68
68
|
|
69
69
|
should "destroy account" do
|
@@ -106,7 +106,7 @@ class AccountsControllerTest < ActionController::TestCase
|
|
106
106
|
context 'but having ownership' do
|
107
107
|
should 'allow updates' do
|
108
108
|
put :update, client_id: @client, id: @account, account: { name: @account.name }
|
109
|
-
assert_redirected_to client_account_path(assigns(:account))
|
109
|
+
assert_redirected_to client_account_path(@client, assigns(:account))
|
110
110
|
end
|
111
111
|
end
|
112
112
|
context 'having no ownership' do
|
@@ -48,30 +48,30 @@ class MongoAccountsControllerTest < ActionController::TestCase
|
|
48
48
|
post :create, mongo_client_id: @client, mongo_account: { name: @account.name }
|
49
49
|
end
|
50
50
|
|
51
|
-
assert_redirected_to
|
51
|
+
assert_redirected_to mongo_account_path(assigns(:mongo_account))
|
52
52
|
end
|
53
53
|
|
54
54
|
should "show account" do
|
55
|
-
get :show,
|
55
|
+
get :show, id: @account.id
|
56
56
|
assert_response :success
|
57
57
|
end
|
58
58
|
|
59
59
|
should "get edit" do
|
60
|
-
get :edit,
|
60
|
+
get :edit, id: @account
|
61
61
|
assert_response :success
|
62
62
|
end
|
63
63
|
|
64
64
|
should "update account" do
|
65
|
-
put :update,
|
66
|
-
assert_redirected_to
|
65
|
+
put :update, id: @account, mongo_account: { name: @account.name }
|
66
|
+
assert_redirected_to mongo_account_path(assigns(:mongo_account))
|
67
67
|
end
|
68
68
|
|
69
69
|
should "destroy account" do
|
70
70
|
assert_difference('MongoAccount.count', -1) do
|
71
|
-
delete :destroy,
|
71
|
+
delete :destroy, id: @account
|
72
72
|
end
|
73
73
|
|
74
|
-
assert_redirected_to mongo_client_mongo_accounts_path
|
74
|
+
assert_redirected_to mongo_client_mongo_accounts_path(@client.id)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -106,7 +106,7 @@ class MongoAccountsControllerTest < ActionController::TestCase
|
|
106
106
|
context 'but having ownership' do
|
107
107
|
should 'allow updates' do
|
108
108
|
put :update, mongo_client_id: @client, id: @account, mongo_account: { name: @account.name }
|
109
|
-
assert_redirected_to
|
109
|
+
assert_redirected_to mongo_account_path(assigns(:mongo_account))
|
110
110
|
end
|
111
111
|
end
|
112
112
|
context 'having no ownership' do
|
@@ -26,8 +26,8 @@ require 'test_helper'
|
|
26
26
|
|
27
27
|
class MongoClientsControllerTest < ActionController::TestCase
|
28
28
|
setup do
|
29
|
-
@client = MongoClient.create #clients(:one)
|
30
29
|
login_as(:system_admin)
|
30
|
+
@client = MongoClient.create #clients(:one)
|
31
31
|
end
|
32
32
|
|
33
33
|
test "should get index" do
|
@@ -27,7 +27,7 @@ require 'test_helper'
|
|
27
27
|
class PermissionsTest < ActiveSupport::TestCase
|
28
28
|
setup do
|
29
29
|
def login_as(role)
|
30
|
-
Trust::Authorization.user = @user = User.
|
30
|
+
Trust::Authorization.user = @user = User.find_or_create_by(name: role)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
context 'Client' do
|
data/test/test_helper.rb
CHANGED
@@ -26,9 +26,13 @@
|
|
26
26
|
ENV["RAILS_ENV"] = "test"
|
27
27
|
|
28
28
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
29
|
+
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
29
30
|
require "rails/test_help"
|
31
|
+
require 'mocha/mini_test'
|
30
32
|
|
31
|
-
|
33
|
+
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
34
|
+
# to be shown.
|
35
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
32
36
|
|
33
37
|
# Load support files
|
34
38
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
@@ -40,6 +44,6 @@ end
|
|
40
44
|
|
41
45
|
class ActionController::TestCase
|
42
46
|
def login_as(role = :guest)
|
43
|
-
User.current = @controller.send(:current_user=, User.
|
47
|
+
User.current = @controller.send(:current_user=, User.find_or_create_by(name: role.to_s))
|
44
48
|
end
|
45
49
|
end
|
data/test/trust_test.rb
CHANGED
@@ -24,103 +24,197 @@
|
|
24
24
|
|
25
25
|
require 'test_helper'
|
26
26
|
|
27
|
+
class TestBase < ActiveRecord::Base
|
28
|
+
end
|
29
|
+
class TestDescendant < TestBase
|
30
|
+
end
|
31
|
+
class TestParentLess < ActiveRecord::Base
|
32
|
+
end
|
33
|
+
|
34
|
+
class Permissions::TestBase < Trust::Permissions
|
35
|
+
end
|
36
|
+
|
27
37
|
class Trust::AuthorizationTest < ActiveSupport::TestCase
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
assert_equal 1, Thread.current["current_user"]
|
32
|
-
end
|
33
|
-
should 'be retrieved from thread' do
|
34
|
-
Thread.current["current_user"] = 2
|
35
|
-
assert_equal 2, Trust::Authorization.user
|
38
|
+
|
39
|
+
class Resource < Trust::Controller::Resource
|
40
|
+
def initialize
|
36
41
|
end
|
42
|
+
attr_accessor :params_handler
|
43
|
+
def parent; :parent; end
|
44
|
+
def instance; :instance; end
|
45
|
+
def klass; TestBase; end
|
37
46
|
end
|
38
|
-
|
39
|
-
context '
|
40
|
-
|
41
|
-
|
47
|
+
|
48
|
+
context 'class method' do
|
49
|
+
context 'access_denied!' do
|
50
|
+
should 'raise exception' do
|
51
|
+
auth = Trust::Authorization.new(:index, TestBase)
|
52
|
+
assert_raises Trust::AccessDenied do
|
53
|
+
auth.access_denied!
|
54
|
+
end
|
42
55
|
end
|
43
|
-
|
56
|
+
end
|
57
|
+
context 'delegation' do
|
58
|
+
setup do
|
59
|
+
@obj = stub('authorization')
|
60
|
+
Trust::Authorization.expects(:new).with(:action, :object_or_class, [:hello]).returns(@obj)
|
44
61
|
end
|
45
|
-
|
46
|
-
|
62
|
+
should 'include authorized?' do
|
63
|
+
@obj.expects(:authorized?).returns(:good)
|
64
|
+
assert_equal :good, Trust::Authorization.authorized?(:action, :object_or_class, [:hello])
|
65
|
+
end
|
66
|
+
should 'include authorize!' do
|
67
|
+
@obj.expects(:authorize!).returns(:good)
|
68
|
+
assert_equal :good, Trust::Authorization.authorize!(:action, :object_or_class, [:hello])
|
47
69
|
end
|
48
70
|
end
|
49
|
-
|
50
|
-
|
71
|
+
context 'user' do
|
72
|
+
should 'be set in thread' do
|
73
|
+
Trust::Authorization.user = 1
|
74
|
+
assert_equal 1, Thread.current["current_user"]
|
75
|
+
end
|
76
|
+
should 'be retrieved from thread' do
|
77
|
+
Thread.current["current_user"] = 2
|
78
|
+
assert_equal 2, Trust::Authorization.user
|
51
79
|
end
|
52
|
-
assert_equal ::Permissions::TestBase, authorizing_class(::TestBase)
|
53
80
|
end
|
54
|
-
|
55
|
-
|
81
|
+
end
|
82
|
+
|
83
|
+
context 'initializtion' do
|
84
|
+
setup do
|
85
|
+
@parent = stub('parent')
|
86
|
+
@user = stub('user')
|
87
|
+
@resource = Resource.new
|
56
88
|
end
|
57
|
-
should '
|
58
|
-
|
59
|
-
|
60
|
-
assert_equal
|
89
|
+
should 'be done properly when no resource is given' do
|
90
|
+
@auth = Trust::Authorization.new('index', TestDescendant, parent: @parent, by: @user)
|
91
|
+
assert_equal :index, @auth.action
|
92
|
+
assert_equal TestDescendant, @auth.klass
|
93
|
+
assert_nil @auth.object
|
94
|
+
assert_equal @parent, @auth.parent
|
95
|
+
assert_equal @user, @auth.actor
|
61
96
|
end
|
97
|
+
should 'be done properly when resource is given' do
|
98
|
+
Trust::Authorization.user = 1
|
99
|
+
@auth = Trust::Authorization.new('show', @resource, by: @user)
|
100
|
+
assert_equal :show, @auth.action
|
101
|
+
assert_equal TestBase, @auth.klass
|
102
|
+
assert_equal :instance, @auth.object
|
103
|
+
assert_equal :parent, @auth.parent
|
104
|
+
assert_equal @user, @auth.actor
|
105
|
+
@auth = Trust::Authorization.new('show', @resource)
|
106
|
+
assert_equal 1, @auth.actor
|
107
|
+
end
|
62
108
|
end
|
63
109
|
|
64
|
-
context '
|
110
|
+
context 'behaviour' do
|
65
111
|
setup do
|
66
|
-
|
112
|
+
@user = stub('user', role_symbols: [:admin])
|
113
|
+
@resource = Resource.new
|
114
|
+
@auth = Trust::Authorization.new('show', @resource, by: @user)
|
115
|
+
end
|
116
|
+
context 'authorize!' do
|
117
|
+
should 'set params_handler on resource' do
|
118
|
+
ph = {require: :klass, permit: [:name, :address]}
|
119
|
+
@auth.resource.expects(:params_handler=).with(ph)
|
120
|
+
@auth.expects(:permissions).returns(ph)
|
121
|
+
@auth.authorize!
|
67
122
|
end
|
68
|
-
|
69
|
-
|
70
|
-
|
123
|
+
should 'raise exception unless authorized' do
|
124
|
+
@auth.expects(:permissions).returns(false)
|
125
|
+
assert_raises Trust::AccessDenied do
|
126
|
+
@auth.authorize!
|
71
127
|
end
|
72
128
|
end
|
73
|
-
TestAuthorizing.any_instance.stubs(:authorized?).returns(true)
|
74
|
-
Trust::Authorization.expects(:authorizing_class).with(String).returns(TestAuthorizing)
|
75
|
-
end
|
76
|
-
should 'instanciate authorizing class and set correct parameters for object' do
|
77
|
-
Trust::Authorization.expects(:user).returns(:user)
|
78
|
-
Validator.expects(:values).with(:user, :action, String, 'object_or_class', :parent)
|
79
|
-
assert Trust::Authorization.authorized?('action', 'object_or_class', :parent)
|
80
129
|
end
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
130
|
+
context 'authorized?' do
|
131
|
+
should 'return the permissions as a boolean value' do
|
132
|
+
@auth.expects(:permissions).returns(false)
|
133
|
+
assert_equal false, @auth.authorized?
|
134
|
+
@auth.expects(:permissions).returns(nil)
|
135
|
+
assert_equal false, @auth.authorized?
|
136
|
+
@auth.expects(:permissions).returns({})
|
137
|
+
assert_equal true, @auth.authorized?
|
138
|
+
end
|
85
139
|
end
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
assert Trust::Authorization.authorized?('action', String, :by => 'TheActor')
|
140
|
+
context 'instance_loaded' do
|
141
|
+
should 'set instance on authorizing class' do
|
142
|
+
@auth.authorization.expects(:subject=).with(:cool)
|
143
|
+
@auth.instance_loaded :cool
|
144
|
+
end
|
92
145
|
end
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
146
|
+
context 'preload' do
|
147
|
+
should 'require resource to be accessible when instantiated' do
|
148
|
+
@auth.instance_variable_set :@resource, nil
|
149
|
+
assert_raises Trust::Authorization::ResourceNotLoaded do
|
150
|
+
@auth.preload
|
151
|
+
end
|
152
|
+
end
|
153
|
+
should 'delegate to permission if resource is set' do
|
154
|
+
@auth.authorization.expects(:preload).returns(:good)
|
155
|
+
@resource.expects(:params_handler=).with(:good)
|
156
|
+
@auth.preload
|
157
|
+
end
|
97
158
|
end
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
159
|
+
context 'permissions' do
|
160
|
+
should 'return the values from the authorizing class' do
|
161
|
+
@authorization = stub('authorizing_class')
|
162
|
+
@auth.instance_variable_set(:@authorization,@authorization)
|
163
|
+
@authorization.expects(:authorized?).returns(false)
|
164
|
+
assert !@auth.permissions
|
165
|
+
@authorization.expects(:authorized?).returns({})
|
166
|
+
assert ({}), @auth.permissions
|
167
|
+
end
|
102
168
|
end
|
103
169
|
end
|
104
|
-
|
105
|
-
context 'authorize!' do
|
106
|
-
should 'call access_denied! unless authorized?' do
|
107
|
-
Trust::Authorization.expects(:access_denied!).once
|
108
|
-
Trust::Authorization.expects(:authorized?).with(1, 2, 3, {}).returns(false)
|
109
|
-
Trust::Authorization.authorize!(1,2,3)
|
110
|
-
end
|
111
|
-
should 'call access_denied! if authorized?' do
|
112
|
-
Trust::Authorization.expects(:access_denied!).never
|
113
|
-
Trust::Authorization.expects(:authorized?).with(1, 2, 3, {}).returns(true)
|
114
|
-
Trust::Authorization.authorize!(1,2,3)
|
115
|
-
end
|
116
|
-
end
|
117
170
|
|
118
|
-
context '
|
119
|
-
|
120
|
-
|
121
|
-
Trust::Authorization.
|
171
|
+
context 'authorizing_class' do
|
172
|
+
setup do
|
173
|
+
def authorizing_class(klass)
|
174
|
+
Trust::Authorization.new(:index, klass).send(:authorizing_class)
|
122
175
|
end
|
123
176
|
end
|
177
|
+
should 'return associated Authorization class if it exists' do
|
178
|
+
assert_equal ::Permissions::TestBase, authorizing_class(::TestBase)
|
179
|
+
end
|
180
|
+
should 'return Authorization::Default if no assocated Authorization class' do
|
181
|
+
assert_equal ::Permissions::Default, authorizing_class(::TestParentLess)
|
182
|
+
end
|
183
|
+
should 'return parent Authorization if specified and none exist for the class' do
|
184
|
+
assert_equal ::Permissions::TestBase, authorizing_class(::TestDescendant)
|
185
|
+
end
|
186
|
+
should 'support customized base classes' do
|
187
|
+
class ::TheBaseClass
|
188
|
+
end
|
189
|
+
class ::TheBaseDescendant < ::TheBaseClass
|
190
|
+
end
|
191
|
+
class ::Permissions::TheBaseClass < Trust::Permissions
|
192
|
+
end
|
193
|
+
assert_equal ::Permissions::TheBaseClass, authorizing_class(::TheBaseDescendant)
|
194
|
+
end
|
124
195
|
end
|
125
196
|
|
197
|
+
|
198
|
+
|
199
|
+
# context 'authorize!' do
|
200
|
+
# setup do
|
201
|
+
# @resource = Resource.new
|
202
|
+
# end
|
203
|
+
# should 'call access_denied! unless permissions given' do
|
204
|
+
# Trust::Authorization.expects(:access_denied!).twice
|
205
|
+
# Trust::Authorization.expects(:check_permissions).with(:index, :instance, :parent, {}).returns(false)
|
206
|
+
# Trust::Authorization.authorize!(:index, @resource)
|
207
|
+
# @resource.expects(:instance).returns nil
|
208
|
+
# Trust::Authorization.expects(:check_permissions).with(:index, :klass, :parent, {}).returns(false)
|
209
|
+
# Trust::Authorization.authorize!(:index, @resource)
|
210
|
+
# assert_equal false, @resource.params_handler
|
211
|
+
# end
|
212
|
+
# should 'call access_denied! if authorized?' do
|
213
|
+
# Trust::Authorization.expects(:access_denied!).never
|
214
|
+
# Trust::Authorization.expects(:check_permissions).with(:show, :instance, :parent, {}).returns({})
|
215
|
+
# Trust::Authorization.authorize!(:show, @resource)
|
216
|
+
# assert_equal ({}), @resource.params_handler
|
217
|
+
# end
|
218
|
+
# end
|
219
|
+
|
126
220
|
end
|
@@ -97,6 +97,21 @@ class Trust::Controller::PropertiesTest < ActiveSupport::TestCase
|
|
97
97
|
assert_equal [:show, :edit, :update, :destroy], @properties.member_actions
|
98
98
|
assert_equal [:index], @properties.collection_actions
|
99
99
|
end
|
100
|
+
should 'discover new_action?' do
|
101
|
+
assert @properties.new_action?( :new)
|
102
|
+
assert @properties.new_action?( 'new')
|
103
|
+
assert !@properties.new_action?( :show)
|
104
|
+
end
|
105
|
+
should 'discover collection_action?' do
|
106
|
+
assert @properties.collection_action?( :index)
|
107
|
+
assert @properties.collection_action?( 'index')
|
108
|
+
assert !@properties.collection_action?( :show)
|
109
|
+
end
|
110
|
+
should 'discover member_action?' do
|
111
|
+
assert @properties.member_action?( :show)
|
112
|
+
assert @properties.member_action?( 'show')
|
113
|
+
assert !@properties.member_action?( :index)
|
114
|
+
end
|
100
115
|
end
|
101
116
|
|
102
117
|
context 'belongs_to' do
|