Class: ResponseMatchers::ResponseLocationMatcher
- Inherits:
-
Object
- Object
- ResponseMatchers::ResponseLocationMatcher
- Defined in:
- lib/responses.rb
Overview
Response matcher that examines ActionController::Response headers for the given location code
Instance Method Summary collapse
-
#failure_message ⇒ Object
What do we tell the user when it fails?.
-
#initialize(url) ⇒ ResponseLocationMatcher
constructor
A new instance of ResponseLocationMatcher.
-
#matches?(target) ⇒ Boolean
Does the given target object match the required location?.
-
#negative_failure_message ⇒ Object
What do we tell the user when it shouldn’t fail but does.
Constructor Details
#initialize(url) ⇒ ResponseLocationMatcher
Returns a new instance of ResponseLocationMatcher.
61 62 63 |
# File 'lib/responses.rb', line 61 def initialize url @url = url end |
Instance Method Details
#failure_message ⇒ Object
What do we tell the user when it fails?
71 72 73 |
# File 'lib/responses.rb', line 71 def "expected the location header to be #{@url}" end |
#matches?(target) ⇒ Boolean
Does the given target object match the required location?
66 67 68 |
# File 'lib/responses.rb', line 66 def matches? target target.headers['Location'] == @url end |
#negative_failure_message ⇒ Object
What do we tell the user when it shouldn’t fail but does
76 77 78 |
# File 'lib/responses.rb', line 76 def "expected the location header to be different to #{@url}" end |