Module: Shoulda::Matchers::ActionController
- Defined in:
- lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb
Overview
:nodoc:
Defined Under Namespace
Classes: RespondWithContentTypeMatcher
Instance Method Summary collapse
-
#respond_with_content_type(content_type) ⇒ Object
Ensures a controller responded with expected ‘response’ content type.
Instance Method Details
#respond_with_content_type(content_type) ⇒ Object
Ensures a controller responded with expected ‘response’ content type.
You can pass an explicit content type such as ‘application/rss+xml’ or its symbolic equivalent :rss or a regular expression such as /rss/
Example:
it { should respond_with_content_type(:xml) }
it { should respond_with_content_type(:csv) }
it { should respond_with_content_type(:atom) }
it { should respond_with_content_type(:yaml) }
it { should respond_with_content_type(:text) }
it { should respond_with_content_type('application/rss+xml') }
it { should respond_with_content_type(/json/) }
20 21 22 |
# File 'lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb', line 20 def respond_with_content_type(content_type) RespondWithContentTypeMatcher.new(content_type) end |