admission 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/admission.gemspec +7 -7
- data/lib/admission/version.rb +1 -1
- metadata +5 -48
- data/.gitignore +0 -40
- data/.rspec +0 -2
- data/.ruby-version +0 -1
- data/Gemfile +0 -7
- data/LICENSE +0 -674
- data/README.md +0 -24
- data/bin/build +0 -10
- data/bin/rspec +0 -8
- data/spec/integration/action_arbitrating_spec.rb +0 -119
- data/spec/integration/resource_arbitrating_spec.rb +0 -276
- data/spec/rspec_config.rb +0 -103
- data/spec/spec_helper.rb +0 -28
- data/spec/test_context/country.rb +0 -24
- data/spec/test_context/index.rb +0 -5
- data/spec/test_context/person.rb +0 -31
- data/spec/test_context/persons_fixtures.rb +0 -43
- data/spec/test_context/privileges_and_rules.rb +0 -119
- data/spec/unit/arbitration_spec.rb +0 -33
- data/spec/unit/index_spec.rb +0 -144
- data/spec/unit/privilege/order_definer_spec.rb +0 -184
- data/spec/unit/privilege_spec.rb +0 -178
- data/spec/unit/rails/action_admission_spec.rb +0 -188
- data/spec/unit/rails/controller_addon_spec.rb +0 -68
- data/spec/unit/rails/scope_resolver_spec.rb +0 -72
- data/spec/unit/resource_arbitration_spec.rb +0 -76
- data/spec/unit/status_spec.rb +0 -79
- data/visualisation/.babelrc +0 -7
- data/visualisation/actions/index.js +0 -0
- data/visualisation/components/app_container.jsx +0 -78
- data/visualisation/components/input_with_select.jsx +0 -177
- data/visualisation/components/nested_list_row.jsx +0 -48
- data/visualisation/components/privilege_select.jsx +0 -70
- data/visualisation/components/privileges_panel.jsx +0 -73
- data/visualisation/components/rules_panel.jsx +0 -124
- data/visualisation/dist/.gitkeep +0 -0
- data/visualisation/helpers.js +0 -69
- data/visualisation/index.jsx +0 -89
- data/visualisation/package.json +0 -27
- data/visualisation/reducers/index.js +0 -35
- data/visualisation/server.rb +0 -23
- data/visualisation/style.scss +0 -248
- data/visualisation/webpack.config.js +0 -47
- data/visualisation/yarn.lock +0 -3354
data/spec/unit/privilege_spec.rb
DELETED
@@ -1,178 +0,0 @@
|
|
1
|
-
require_relative '../spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Admission::Privilege do
|
4
|
-
|
5
|
-
def new_privilege *args
|
6
|
-
Admission::Privilege.new *args
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:privilege){ new_privilege :man }
|
10
|
-
|
11
|
-
let(:privilege_superman){ new_privilege :superman }
|
12
|
-
let(:privilege_uberman){ new_privilege :uberman }
|
13
|
-
|
14
|
-
|
15
|
-
describe '#new' do
|
16
|
-
|
17
|
-
it 'create base privilege' do
|
18
|
-
expect(new_privilege :man).to have_attributes(name: :man, level: :base)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'creates with level' do
|
22
|
-
expect(new_privilege :man, :lvl1).to have_attributes(name: :man, level: :lvl1)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'changes names to symbols' do
|
26
|
-
expect(new_privilege 'man', 'lvl1').to have_attributes(name: :man, level: :lvl1)
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'hash is combination of name and level' do
|
30
|
-
expect(privilege.hash).to eq([:man, :base].hash)
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
describe '#inherited' do
|
37
|
-
|
38
|
-
it 'nothing' do
|
39
|
-
expect(privilege.inherited).to be_nil
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'single item' do
|
43
|
-
privilege.inherits_from privilege_superman
|
44
|
-
expect(privilege.inherited).to contain_exactly(privilege_superman)
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'arguments list' do
|
48
|
-
privilege.inherits_from privilege_superman, privilege_uberman
|
49
|
-
expect(privilege.inherited).to contain_exactly(privilege_superman, privilege_uberman)
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
|
54
|
-
|
55
|
-
describe '#eql?' do
|
56
|
-
|
57
|
-
it 'compares by hash' do
|
58
|
-
p1 = new_privilege :man
|
59
|
-
p2 = new_privilege :man
|
60
|
-
expect(p1).to eql(p2)
|
61
|
-
|
62
|
-
p2.instance_variable_set :@hash, nil.hash
|
63
|
-
expect(p1).not_to eql(p2)
|
64
|
-
|
65
|
-
expect(p1).not_to eql(new_privilege :self)
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
|
71
|
-
describe '#eql_or_inherits?' do
|
72
|
-
|
73
|
-
it 'returns true since it equals sought privilege' do
|
74
|
-
expect(privilege.eql_or_inherits? privilege).to eq(true)
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'return false when does not inherit any' do
|
78
|
-
expect(privilege_superman.eql_or_inherits? privilege_uberman).to eq(false)
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'finds nested inherited privilege and therefore evaluates to true' do
|
82
|
-
top_privilege = new_privilege 'man', 'top'
|
83
|
-
top_privilege.inherits_from new_privilege('man', 'branch'),
|
84
|
-
new_privilege('man', 'middle').tap{|p| p.inherits_from new_privilege('man')}
|
85
|
-
|
86
|
-
sought = new_privilege 'man'
|
87
|
-
expect(top_privilege.eql_or_inherits? sought).to eq(true)
|
88
|
-
expect(top_privilege.eql_or_inherits? new_privilege('man', 'nope')).to eq(false)
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'ignores context' do
|
92
|
-
expect(privilege.eql_or_inherits? privilege.dup_with_context(:czech)).to eq(true)
|
93
|
-
end
|
94
|
-
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
describe '#inspect' do
|
99
|
-
|
100
|
-
it 'prints name and level' do
|
101
|
-
expect(privilege).to receive(:text_key).and_call_original
|
102
|
-
expect(privilege.inspect).to eq('#<Privilege key=man>')
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'prints inheritance' do
|
106
|
-
privilege_superman.inherits_from privilege
|
107
|
-
expect(privilege).to receive(:text_key).and_call_original
|
108
|
-
expect(privilege_superman.inspect).to eq(
|
109
|
-
'#<Privilege key=superman inherited=[man]>'
|
110
|
-
)
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
describe '#to_s' do
|
116
|
-
|
117
|
-
it 'prints name and level' do
|
118
|
-
expect(privilege).to receive(:text_key).and_call_original
|
119
|
-
expect(privilege.to_s).to eq('privilege man')
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'prints inheritance' do
|
123
|
-
privilege2 = new_privilege('mans', 'not').dup_with_context 'hot'
|
124
|
-
expect(privilege2).to receive(:text_key).and_call_original
|
125
|
-
expect(privilege2.to_s).to eq('privilege mans-not, context hot')
|
126
|
-
end
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
|
131
|
-
describe '#dup_with_context' do
|
132
|
-
|
133
|
-
it 'self when context is nil' do
|
134
|
-
p2 = privilege.dup_with_context
|
135
|
-
expect(p2).to be_a(Admission::Privilege)
|
136
|
-
expect(p2).to equal(privilege)
|
137
|
-
|
138
|
-
p2 = privilege.dup_with_context nil
|
139
|
-
expect(p2).to be_a(Admission::Privilege)
|
140
|
-
expect(p2).to equal(privilege)
|
141
|
-
end
|
142
|
-
|
143
|
-
it 'duplicates only change context' do
|
144
|
-
p2 = privilege.dup_with_context :moon
|
145
|
-
expect(p2).to be_a(Admission::Privilege)
|
146
|
-
expect(p2).not_to equal(privilege)
|
147
|
-
expect(p2).to eql(privilege)
|
148
|
-
expect(p2).to have_attributes(name: :man, level: :base, context: :moon)
|
149
|
-
end
|
150
|
-
|
151
|
-
end
|
152
|
-
|
153
|
-
|
154
|
-
describe '.get_from_order' do
|
155
|
-
|
156
|
-
it 'returns nil for bad name' do
|
157
|
-
index = Admission::Privilege::OrderDefiner.define{ privilege :man }
|
158
|
-
expect(Admission::Privilege.get_from_order index, :woman).to be_nil
|
159
|
-
end
|
160
|
-
|
161
|
-
it 'returns base privilege' do
|
162
|
-
index = Admission::Privilege::OrderDefiner.define{ privilege :man }
|
163
|
-
expect(Admission::Privilege.get_from_order index, :man).to be_eql(privilege)
|
164
|
-
end
|
165
|
-
|
166
|
-
it 'returns specific level privilege' do
|
167
|
-
index = Admission::Privilege::OrderDefiner.define{ privilege :vassal, levels: %i[lord] }
|
168
|
-
expect(Admission::Privilege.get_from_order index, :vassal, :lord).to be_eql(new_privilege :vassal, :lord)
|
169
|
-
end
|
170
|
-
|
171
|
-
it 'returns nil for bad level' do
|
172
|
-
index = Admission::Privilege::OrderDefiner.define{ privilege :vassal, levels: %i[lord] }
|
173
|
-
expect(Admission::Privilege.get_from_order index, :vassal, :pope).to be_nil
|
174
|
-
end
|
175
|
-
|
176
|
-
end
|
177
|
-
|
178
|
-
end
|
@@ -1,188 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Admission::Rails::ActionAdmission do
|
4
|
-
|
5
|
-
let(:instance){ Admission::Rails::ActionAdmission.new 'aaa' }
|
6
|
-
|
7
|
-
def mock_resolver_creation
|
8
|
-
allow(Admission::Rails::ScopeResolver).to receive(:using).
|
9
|
-
and_return(Admission::Rails::ScopeResolver.void)
|
10
|
-
end
|
11
|
-
|
12
|
-
it '.new' do
|
13
|
-
expect(instance.controller).to eq('aaa')
|
14
|
-
expect(instance.resolvers).to eq({})
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '#set_resolver' do
|
18
|
-
|
19
|
-
it 'sets single resolver' do
|
20
|
-
instance.send :set_resolver, 'a1', :resolver
|
21
|
-
expect(instance.resolvers).to eq({
|
22
|
-
'a1' => :resolver
|
23
|
-
})
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'sets array of resolvers' do
|
27
|
-
instance.send :set_resolver, %w[a1 b2], :resolver
|
28
|
-
expect(instance.resolvers).to eq({
|
29
|
-
'a1' => :resolver,
|
30
|
-
'b2' => :resolver
|
31
|
-
})
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'converts actions to string' do
|
35
|
-
instance.send :set_resolver, 1, :resolver
|
36
|
-
instance.send :set_resolver, [:aaa, true], :resolver
|
37
|
-
expect(instance.resolvers).to eq({
|
38
|
-
'1' => :resolver,
|
39
|
-
'aaa' => :resolver,
|
40
|
-
'true' => :resolver
|
41
|
-
})
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
describe '#for' do
|
47
|
-
|
48
|
-
it 'uses keyword argument as the resolver' do
|
49
|
-
resolver = :resolver
|
50
|
-
expect(Admission::Rails::ScopeResolver).to receive(:using).
|
51
|
-
twice.and_return(resolver)
|
52
|
-
instance.for :act1, resolve_to: resolver
|
53
|
-
expect(instance.resolvers).to eq({'act1' => resolver})
|
54
|
-
instance.for(:act1, resolve_to: resolver){}
|
55
|
-
expect(instance.resolvers).to eq({'act1' => resolver})
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'uses block as the resolver' do
|
59
|
-
resolver = :resolver
|
60
|
-
expect(Admission::Rails::ScopeResolver).to receive(:using).
|
61
|
-
and_return(resolver)
|
62
|
-
instance.for(:act1){}
|
63
|
-
expect(instance.resolvers).to eq({'act1' => resolver})
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'accepts list of actions' do
|
67
|
-
instance.for :a1, :b2, resolve_to: ->{}
|
68
|
-
expect(instance.resolvers.keys).to eq(%w[a1 b2])
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
describe '#for_all' do
|
74
|
-
|
75
|
-
it 'passes resolver as argument' do
|
76
|
-
resolver = ->{}
|
77
|
-
expect(instance).to receive(:for).with(
|
78
|
-
Admission::Rails::ActionAdmission::ALL_ACTIONS,
|
79
|
-
hash_including(resolve_to: resolver)
|
80
|
-
)
|
81
|
-
instance.for_all resolver
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'passes resolver as block' do
|
85
|
-
resolver = ->{}
|
86
|
-
expect(instance).to receive(:for).with(
|
87
|
-
Admission::Rails::ActionAdmission::ALL_ACTIONS,
|
88
|
-
hash_including(resolve_to: resolver)
|
89
|
-
)
|
90
|
-
instance.for_all &resolver
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'passes no resolver -> default' do
|
94
|
-
expect(instance).to receive(:for).with(
|
95
|
-
Admission::Rails::ActionAdmission::ALL_ACTIONS,
|
96
|
-
hash_including(resolve_to: Admission::Rails::ScopeResolver.default)
|
97
|
-
)
|
98
|
-
instance.for_all
|
99
|
-
end
|
100
|
-
|
101
|
-
end
|
102
|
-
|
103
|
-
describe '#for_resource' do
|
104
|
-
|
105
|
-
class RailsString < String
|
106
|
-
attr_reader :singularize
|
107
|
-
def initialize singular, plural
|
108
|
-
super plural
|
109
|
-
@singularize = singular
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
let(:instance) {
|
114
|
-
controller = double('controller')
|
115
|
-
allow(controller).to receive(:controller_name).
|
116
|
-
and_return(RailsString.new('user', 'users'))
|
117
|
-
Admission::Rails::ActionAdmission.new controller
|
118
|
-
}
|
119
|
-
|
120
|
-
it 'uses resource finder as the resolver' do
|
121
|
-
instance.for_resource :aaa
|
122
|
-
resolver = instance.resolvers['aaa']
|
123
|
-
expect(resolver.instance_variable_get '@scope').to eq(:find_user)
|
124
|
-
expect(instance.resolvers.keys.length).to eq(1)
|
125
|
-
end
|
126
|
-
|
127
|
-
it 'uses scope helper as the resolver' do
|
128
|
-
instance.for_resource :aaa, nested: true
|
129
|
-
resolver = instance.resolvers['aaa']
|
130
|
-
expect(resolver.instance_variable_get '@scope').to eq(:users_admission_scope)
|
131
|
-
expect(instance.resolvers.keys.length).to eq(1)
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'sets the finder for all actions' do
|
135
|
-
instance.for_resource all: true
|
136
|
-
resolver = instance.resolvers[Admission::Rails::ActionAdmission::ALL_ACTIONS]
|
137
|
-
expect(resolver.instance_variable_get '@scope').to eq(:find_user)
|
138
|
-
expect(instance.resolvers.keys.length).to eq(1)
|
139
|
-
end
|
140
|
-
|
141
|
-
it 'accepts list of actions' do
|
142
|
-
instance.for_resource :a1, :b2
|
143
|
-
expect(instance.resolvers.keys).to eq(%w[a1 b2])
|
144
|
-
end
|
145
|
-
|
146
|
-
end
|
147
|
-
|
148
|
-
describe '#skip' do
|
149
|
-
|
150
|
-
it 'uses vois resolver' do
|
151
|
-
instance.skip :a1
|
152
|
-
expect(instance.resolvers).to eq('a1' => Admission::Rails::ScopeResolver.void)
|
153
|
-
end
|
154
|
-
|
155
|
-
it 'accepts list of actions' do
|
156
|
-
instance.skip :a1, :b2
|
157
|
-
expect(instance.resolvers.keys).to eq(%w[a1 b2])
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|
161
|
-
|
162
|
-
describe '#scope_for_action' do
|
163
|
-
|
164
|
-
it 'takes particular action resolver' do
|
165
|
-
instance.resolvers['a1'] = :find_user
|
166
|
-
expect(instance.scope_for_action 'a1').to eq(:find_user)
|
167
|
-
end
|
168
|
-
|
169
|
-
it 'takes fallback all-action resolver' do
|
170
|
-
instance.resolvers[Admission::Rails::ActionAdmission::ALL_ACTIONS] = :find_user
|
171
|
-
expect(instance.scope_for_action 'a1').to eq(:find_user)
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'takes scope from parent object' do
|
175
|
-
class RootController
|
176
|
-
def self.action_admission
|
177
|
-
@action_admission ||= Admission::Rails::ActionAdmission.new(self)
|
178
|
-
end
|
179
|
-
end
|
180
|
-
ChildController = Class.new RootController
|
181
|
-
|
182
|
-
RootController.action_admission.resolvers['a1'] = :find_user
|
183
|
-
expect(ChildController.action_admission.scope_for_action 'a1').to eq(:find_user)
|
184
|
-
end
|
185
|
-
|
186
|
-
end
|
187
|
-
|
188
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Admission::Rails::ControllerAddon do
|
4
|
-
|
5
|
-
ADDON = Admission::Rails::ControllerAddon
|
6
|
-
|
7
|
-
def stub_action_admission
|
8
|
-
action_admission = double('ActionAdmission')
|
9
|
-
stub_const('Admission::Rails::ActionAdmission', action_admission)
|
10
|
-
|
11
|
-
instance = double('ActionAdmission.new')
|
12
|
-
allow(instance).to receive(:for_all)
|
13
|
-
allow(action_admission).to receive(:new).and_return(instance)
|
14
|
-
|
15
|
-
[action_admission, instance]
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:controller){
|
19
|
-
controller = Class.new do
|
20
|
-
def action_name; 'home'; end
|
21
|
-
def self.before_action *_; end
|
22
|
-
end
|
23
|
-
controller.include ADDON
|
24
|
-
}
|
25
|
-
|
26
|
-
it 'sets default configuration on inclusion' do
|
27
|
-
stub_action_admission
|
28
|
-
controller
|
29
|
-
expect(controller.action_admission).to have_received(:for_all).with(no_args)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'caches action_admission instance' do
|
33
|
-
klass, _ = stub_action_admission
|
34
|
-
controller.action_admission
|
35
|
-
controller.action_admission
|
36
|
-
child_controller = Class.new controller
|
37
|
-
child_controller.action_admission
|
38
|
-
child_controller.action_admission
|
39
|
-
expect(klass).to have_received(:new).with(controller)
|
40
|
-
expect(klass).to have_received(:new).with(child_controller)
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'adds instance methods' do
|
44
|
-
stub_action_admission
|
45
|
-
expect(controller.private_method_defined? :request_admission!).to be_truthy
|
46
|
-
expect(controller.private_method_defined? :assure_admission).to be_truthy
|
47
|
-
end
|
48
|
-
|
49
|
-
it '#assure_admission raises no scope error' do
|
50
|
-
_, instance = stub_action_admission
|
51
|
-
allow(instance).to receive(:scope_for_action)
|
52
|
-
expect{
|
53
|
-
controller.new.send :assure_admission
|
54
|
-
}.to raise_error(Admission::Rails::ScopeNotDefined)
|
55
|
-
end
|
56
|
-
|
57
|
-
it '#assure_admission request admission with particular scope' do
|
58
|
-
_, instance = stub_action_admission
|
59
|
-
scope_resolver = double('scope_resolver')
|
60
|
-
allow(scope_resolver).to receive(:apply).and_yield(:application)
|
61
|
-
allow(instance).to receive(:scope_for_action).and_return(scope_resolver)
|
62
|
-
|
63
|
-
controller_instance = controller.new
|
64
|
-
expect(controller_instance).to receive(:request_admission!).with(:home, :application)
|
65
|
-
controller_instance.send :assure_admission
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Admission::Rails::ScopeResolver do
|
4
|
-
|
5
|
-
it '.new freezes the instance' do
|
6
|
-
instance = Admission::Rails::ScopeResolver.new nil
|
7
|
-
expect(instance.instance_variable_get '@scope').to be_nil
|
8
|
-
expect(instance).to be_frozen
|
9
|
-
end
|
10
|
-
|
11
|
-
describe '#apply' do
|
12
|
-
|
13
|
-
it 'Symbol scope' do
|
14
|
-
instance = Admission::Rails::ScopeResolver.new :to_s
|
15
|
-
applied = false
|
16
|
-
|
17
|
-
instance.apply 42 do |value|
|
18
|
-
expect(value).to eq('42')
|
19
|
-
applied = true
|
20
|
-
end
|
21
|
-
|
22
|
-
expect(applied).to be_truthy
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'Proc scope' do
|
26
|
-
instance = Admission::Rails::ScopeResolver.new ->{ to_s }
|
27
|
-
applied = false
|
28
|
-
|
29
|
-
instance.apply 42 do |value|
|
30
|
-
expect(value).to eq('42')
|
31
|
-
applied = true
|
32
|
-
end
|
33
|
-
|
34
|
-
expect(applied).to be_truthy
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'nil scope' do
|
38
|
-
instance = Admission::Rails::ScopeResolver.new nil
|
39
|
-
|
40
|
-
instance.apply 42 do
|
41
|
-
fail 'should not be called'
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
describe '.using' do
|
48
|
-
|
49
|
-
it 'returns the very same instance' do
|
50
|
-
instance = Admission::Rails::ScopeResolver.using Admission::Rails::ScopeResolver.void
|
51
|
-
expect(instance).to be(Admission::Rails::ScopeResolver.void)
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'creates instance' do
|
55
|
-
instance = Admission::Rails::ScopeResolver.using :to_s
|
56
|
-
expect(instance.instance_variable_get '@scope').to be(:to_s)
|
57
|
-
|
58
|
-
proc = ->{}
|
59
|
-
instance = Admission::Rails::ScopeResolver.using proc
|
60
|
-
expect(instance.instance_variable_get '@scope').to be(proc)
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'prints nice error message' do
|
64
|
-
expect{ Admission::Rails::ScopeResolver.using nil }.to raise_error(
|
65
|
-
'Function to resolve the admission scope needed.'+
|
66
|
-
' Pass a block or `resolve_to:` parameter.'
|
67
|
-
)
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|