Class: ResponseMatchers::ResponseStatusMatcher
- Inherits:
-
Object
- Object
- ResponseMatchers::ResponseStatusMatcher
- Defined in:
- lib/responses.rb
Overview
Response matcher that examines ActionController::Response headers for the required status code
Instance Method Summary collapse
-
#failure_message ⇒ Object
What do we tell the user when it fails?.
-
#initialize(status_code) ⇒ ResponseStatusMatcher
constructor
Set up this matcher as required.
-
#matches?(target) ⇒ Boolean
Does the given target object match the required status code?.
-
#negative_failure_message ⇒ Object
What do we tell the user when it shouldn’t fail but does.
Constructor Details
#initialize(status_code) ⇒ ResponseStatusMatcher
Set up this matcher as required
44 45 46 |
# File 'lib/responses.rb', line 44 def initialize status_code @status_code = status_code end |
Instance Method Details
#failure_message ⇒ Object
What do we tell the user when it fails?
54 55 56 57 58 59 |
# File 'lib/responses.rb', line 54 def a = " expected the location header to be \#{@status_code.inspect}\n instead it was \#{@target_status.inspect}\n EOF\nend\n" |
#matches?(target) ⇒ Boolean
Does the given target object match the required status code?
49 50 51 |
# File 'lib/responses.rb', line 49 def matches? target (@target_status = target.status) == @status_code end |
#negative_failure_message ⇒ Object
What do we tell the user when it shouldn’t fail but does
62 63 64 |
# File 'lib/responses.rb', line 62 def "expected the response to be different to #{@status_code.inspect}" end |