Module: Seatbelt::AssertContentType
- Included in:
- Minitest::Test, Minitest::Unit::TestCase, Test::Unit::TestCase
- Defined in:
- lib/seatbelt/assert_content_type.rb
Constant Summary collapse
- SUPPORTED_MIME_TYPES =
{ 'html' => 'text/html', 'xhtml' => 'text/html', 'text' => 'text/plain', 'txt' => 'text/plain', 'js' => 'text/javascript', 'css' => 'text/css', 'ics' => 'text/calendar', 'csv' => 'text/csv', 'xml' => 'application/xml', 'rss' => 'application/rss+xml', 'atom' => 'application/atom+xml', 'yaml' => 'application/x-yaml', 'multipart_form' => 'multipart/form-data', 'url_encoded_form' => 'application/x-www-form-urlencoded', 'json' => 'application/json', 'pdf' => 'application/pdf', 'xls' => 'application/vnd.ms-excel' }
Instance Method Summary collapse
Instance Method Details
#assert_content_type(content_type, header = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/seatbelt/assert_content_type.rb', line 24 def assert_content_type(content_type, header=nil) header = @response.headers["Content-Type"] if header.nil? && @response if header # assert_match /application\/vnd.ms-excel/, @response.header["Content-Type"] assert_match matcher_for(content_type), header else assert false, "nothing to match against!" end end |