Class: MuckEngine::Controllers::Matchers::RequireRoleMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/muck-engine/test/controllers/matchers/role_matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(role, action, verb, role_url, flash_message, context) ⇒ RequireRoleMatcher

Returns a new instance of RequireRoleMatcher.



21
22
23
24
25
26
27
28
# File 'lib/muck-engine/test/controllers/matchers/role_matcher.rb', line 21

def initialize(role, action, verb, role_url, flash_message, context)
  @role = role
  @action = action
  @verb = verb
  @role_url = role_url
  @context = context
  @flash_message = flash_message
end

Instance Method Details

#descriptionObject



39
40
41
# File 'lib/muck-engine/test/controllers/matchers/role_matcher.rb', line 39

def description
  "require role #{@action}"
end

#failure_messageObject



35
36
37
# File 'lib/muck-engine/test/controllers/matchers/role_matcher.rb', line 35

def failure_message
  "Expected a '#{@action}' to '#{@action}' to require role '#{@role}'"
end

#matches?(controller) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/muck-engine/test/controllers/matchers/role_matcher.rb', line 30

def matches?(controller)
  @controller = controller
  requires_role?
end