Class: Shoulda::Matchers::ActionController::RespondWithContentTypeMatcher
- Inherits:
-
Object
- Object
- Shoulda::Matchers::ActionController::RespondWithContentTypeMatcher
- Defined in:
- lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(content_type) ⇒ RespondWithContentTypeMatcher
constructor
A new instance of RespondWithContentTypeMatcher.
- #matches?(controller) ⇒ Boolean
Constructor Details
#initialize(content_type) ⇒ RespondWithContentTypeMatcher
Returns a new instance of RespondWithContentTypeMatcher.
25 26 27 |
# File 'lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb', line 25 def initialize(content_type) @content_type = look_up_content_type(content_type) end |
Instance Method Details
#description ⇒ Object
29 30 31 |
# File 'lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb', line 29 def description "respond with content type of #{@content_type}" end |
#failure_message ⇒ Object
42 43 44 |
# File 'lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb', line 42 def "Expected #{expectation}" end |
#failure_message_for_should ⇒ Object
38 39 40 |
# File 'lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb', line 38 def "Expected #{expectation}" end |
#failure_message_for_should_not ⇒ Object
46 47 48 |
# File 'lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb', line 46 def "Did not expect #{expectation}" end |
#failure_message_when_negated ⇒ Object
50 51 52 |
# File 'lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb', line 50 def "Did not expect #{expectation}" end |
#matches?(controller) ⇒ Boolean
33 34 35 36 |
# File 'lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb', line 33 def matches?(controller) @controller = controller content_type_matches_regexp? || content_type_matches_string? end |