Class: RSpecApi::Matchers::ContentType::Matcher
- Inherits:
-
Headers::Matcher
- Object
- Response::Matcher
- Headers::Matcher
- RSpecApi::Matchers::ContentType::Matcher
- Defined in:
- lib/rspec-api/matchers/content_type/matcher.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
Attributes inherited from Response::Matcher
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(content_type) ⇒ Matcher
constructor
A new instance of Matcher.
- #matches?(response) ⇒ Boolean
Methods inherited from Response::Matcher
#failure_message_for_should, #failure_message_for_should_not
Constructor Details
#initialize(content_type) ⇒ Matcher
Returns a new instance of Matcher.
9 10 11 |
# File 'lib/rspec-api/matchers/content_type/matcher.rb', line 9 def initialize(content_type) @content_type = content_type end |
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type.
7 8 9 |
# File 'lib/rspec-api/matchers/content_type/matcher.rb', line 7 def content_type @content_type end |
Instance Method Details
#description ⇒ Object
17 18 19 |
# File 'lib/rspec-api/matchers/content_type/matcher.rb', line 17 def description %Q{include 'Content-Type': '#{content_type}'} end |
#matches?(response) ⇒ Boolean
13 14 15 |
# File 'lib/rspec-api/matchers/content_type/matcher.rb', line 13 def matches?(response) super && headers.key?('Content-Type') && content_type.match(headers['Content-Type']) end |