Sha256: d3ac8488e617517cdd1216dbf3baf6ad7100b7d925eb74f6cf2ab3a9b080e38f

Contents?: true

Size: 544 Bytes

Versions: 5

Compression:

Stored size: 544 Bytes

Contents

RSpec::Matchers.define :have_content_type do |content_type|
  match do |response|
    response.headers['Content-Type'] =~ /^#{content_type.to_s}/
  end
  
  failure_message_for_should do |response|
    "expected the response to have content type #{expected} but found #{response.headers['Content-Type']}"
  end

  failure_message_for_should_not do |response|
    "expected the response not to have content type #{expected} but found #{response.headers['Content-Type']}"
  end

  description do
    "have content type #{content_type}"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
droom-0.5.3 spec/support/matchers/content_type_matcher.rb
droom-0.4.3 spec/support/matchers/content_type_matcher.rb
droom-0.4.2 spec/support/matchers/content_type_matcher.rb
droom-0.4.1 spec/support/matchers/content_type_matcher.rb
droom-0.2.1 spec/support/matchers/content_type_matcher.rb