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
39 40 41 |
# File 'lib/responses.rb', line 39 def initialize status_code @status_code = status_code end |
Instance Method Details
#failure_message ⇒ Object
What do we tell the user when it fails?
49 50 51 |
# File 'lib/responses.rb', line 49 def "expected the response to be #{@status_code}" end |
#matches?(target) ⇒ Boolean
Does the given target object match the required status code?
44 45 46 |
# File 'lib/responses.rb', line 44 def matches? target target.headers['Status'] == @status_code end |
#negative_failure_message ⇒ Object
What do we tell the user when it shouldn’t fail but does
54 55 56 |
# File 'lib/responses.rb', line 54 def "expected the response to be different to #{@status_code}" end |