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.
69 70 71 |
# File 'lib/responses.rb', line 69 def initialize url @url = url end |
Instance Method Details
#failure_message ⇒ Object
What do we tell the user when it fails?
79 80 81 82 83 84 |
# File 'lib/responses.rb', line 79 def a = <<-EOF expected the location header to be #{@target_url.inspect} instead it was #{@url.inspect} EOF end |
#matches?(target) ⇒ Boolean
Does the given target object match the required location?
74 75 76 |
# File 'lib/responses.rb', line 74 def matches? target (@target_url = target.headers['Location']) == @url end |
#negative_failure_message ⇒ Object
What do we tell the user when it shouldn’t fail but does
87 88 89 |
# File 'lib/responses.rb', line 87 def "expected the location header to be different to #{@url.inspect}" end |