Class: Suhyo::ControllerMatchers::DenyAccess

Inherits:
Object
  • Object
show all
Defined in:
lib/suhyo/controller_matchers.rb

Instance Method Summary collapse

Instance Method Details

#failure_messageObject



9
10
11
12
13
14
15
# File 'lib/suhyo/controller_matchers.rb', line 9

def failure_message
	if @response.redirect?
		"expected response to deny access (403 or 302 to #{Suhyo.config.access_denied_url}). Status was #{@response.status} with redirect to #{@response.redirect_url}."
	else
		"expected response to deny access (403 or 302 to #{Suhyo.config.access_denied_url}). Status was #{@response.status}."
	end
end

#matches?(response) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
# File 'lib/suhyo/controller_matchers.rb', line 4

def matches?(response)
	@response = response
	@response.status.split(' ').first == '403' or (@response.redirect? and response.redirect_url == Suhyo.config.access_denied_url)
end

#negative_failure_messageObject



17
18
19
# File 'lib/suhyo/controller_matchers.rb', line 17

def negative_failure_message
	'expected response not to deny access'
end