class ActionPolicy::TestHelper::WithScopeTarget

Attributes

scopes[R]

Public Class Methods

new(scopes) click to toggle source
# File lib/action_policy/test_helper.rb, line 11
def initialize(scopes)
  @scopes = scopes
end

Public Instance Methods

with_target() { |first.target| ... } click to toggle source
# File lib/action_policy/test_helper.rb, line 15
def with_target
  if scopes.size > 1
    raise "Too many matching scopings (#{scopes.size}), " \
          "you can run `.with_target` only when there is the only one match"
  end

  yield scopes.first.target
end