class Shoulda::ActionController::Matchers::RespondWithContentTypeMatcher
:nodoc:
def description
def description "respond with content type of #{@content_type}" end
def expectation
def expectation "content type to be #{@content_type}, " << "but was #{response_content_type}" end
def failure_message
def failure_message "Expected #{expectation}" end
def initialize(content_type)
def initialize(content_type) @content_type = if content_type.is_a?(Symbol) lookup_by_extension(content_type) else content_type end end
def lookup_by_extension(extension)
def lookup_by_extension(extension) Mime::Type.lookup_by_extension(extension.to_s).to_s end
def matches?(controller)
def matches?(controller) @controller = controller if @content_type.is_a?(Regexp) response_content_type =~ @content_type else response_content_type == @content_type end end
def negative_failure_message
def negative_failure_message "Did not expect #{expectation}" end
def response_content_type
def response_content_type @controller.response.content_type end