Methods
A
P
S
Instance Public methods
assert_not_permit(user, record, action)
   # File rhino/rhino/lib/rhino/test_case/policy.rb
13 def assert_not_permit(user, record, action)
14   msg = "User #{user.inspect} should NOT be permitted to #{action} #{record}, but is permitted"
15   assert_not permit(user, record, action), msg
16 end
assert_params(user, record, action, expected)
   # File rhino/rhino/lib/rhino/test_case/policy.rb
25 def assert_params(user, record, action, expected)
26   permitted_params = params(user, record, action)
27   msg = "User #{user.inspect} should be permitted #{action} params for #{record}, but isn't"
28   assert_empty permitted_params.to_a.difference(expected), msg
29   assert_empty expected.difference(permitted_params.to_a), msg
30 end
assert_permit(user, record, action)
   # File rhino/rhino/lib/rhino/test_case/policy.rb
 8 def assert_permit(user, record, action)
 9   msg = "User #{user.inspect} should be permitted to #{action} #{record}, but isn't permitted"
10   assert permit(user, record, action), msg
11 end
assert_scope_empty(user, scope)
   # File rhino/rhino/lib/rhino/test_case/policy.rb
32 def assert_scope_empty(user, scope)
33   resolved = scope(user, scope)
34   msg = "User #{user.inspect} should have no scope, but receives #{resolved.inspect}"
35   assert_equal 0, resolved.count, msg
36 end
assert_scope_only(user, scope, expected)
   # File rhino/rhino/lib/rhino/test_case/policy.rb
18 def assert_scope_only(user, scope, expected)
19   resolved = scope(user, scope)
20   msg = "User #{user.inspect} should be scoped to #{expected.inspect}, but receives #{resolved.inspect}"
21   assert_empty resolved.to_a.difference(expected), msg
22   assert_empty expected.difference(resolved.to_a), msg
23 end
params(user, record, action)
   # File rhino/rhino/lib/rhino/test_case/policy.rb
60 def params(user, record, action)
61   policy_instance(user, record).public_send("permitted_attributes_for_#{action}")
62 end
permit(user, record, action)
   # File rhino/rhino/lib/rhino/test_case/policy.rb
56 def permit(user, record, action)
57   policy_instance(user, record).public_send("#{action}?")
58 end
policy_instance(user, record)
   # File rhino/rhino/lib/rhino/test_case/policy.rb
42 def policy_instance(user, record)
43   klass = policy_test_name.to_s.gsub(/Test/, "")
44   klass.constantize.new(user, record)
45 end
policy_scope_instance(user, scope)
   # File rhino/rhino/lib/rhino/test_case/policy.rb
47 def policy_scope_instance(user, scope)
48   klass = policy_test_name.to_s.gsub(/Test/, "::Scope")
49   klass.constantize.new(user, scope)
50 end
policy_test_name()
   # File rhino/rhino/lib/rhino/test_case/policy.rb
38 def policy_test_name
39   self.class.ancestors.find { |a| a.to_s.end_with?("PolicyTest") }
40 end
scope(user, scope)
   # File rhino/rhino/lib/rhino/test_case/policy.rb
52 def scope(user, scope)
53   policy_scope_instance(user, scope).resolve
54 end