Class: Clearance::Testing::Matchers::DenyAccessMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/clearance/testing/deny_access_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, opts) ⇒ DenyAccessMatcher

Returns a new instance of DenyAccessMatcher.



11
12
13
14
15
16
17
18
# File 'lib/clearance/testing/deny_access_matcher.rb', line 11

def initialize(context, opts)
  @context = context
  @flash = opts[:flash]
  @url = opts[:redirect]

  @failure_message = ''
  @failure_message_when_negated = ''
end

Instance Attribute Details

#failure_messageObject (readonly)

Returns the value of attribute failure_message.



9
10
11
# File 'lib/clearance/testing/deny_access_matcher.rb', line 9

def failure_message
  @failure_message
end

#failure_message_when_negatedObject (readonly)

Returns the value of attribute failure_message_when_negated.



9
10
11
# File 'lib/clearance/testing/deny_access_matcher.rb', line 9

def failure_message_when_negated
  @failure_message_when_negated
end

Instance Method Details

#descriptionObject



20
21
22
# File 'lib/clearance/testing/deny_access_matcher.rb', line 20

def description
  'deny access'
end

#failure_message_for_shouldObject



29
30
31
# File 'lib/clearance/testing/deny_access_matcher.rb', line 29

def failure_message_for_should
  failure_message
end

#failure_message_for_should_notObject



33
34
35
# File 'lib/clearance/testing/deny_access_matcher.rb', line 33

def failure_message_for_should_not
  failure_message_when_negated
end

#matches?(controller) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/clearance/testing/deny_access_matcher.rb', line 24

def matches?(controller)
  @controller = controller
  sets_the_flash? && redirects_to_url?
end