Sha256: c21098336618cdcd30533667b29334a80677426ef4c80c3908ee7cced3947ce5
Contents?: true
Size: 1.17 KB
Versions: 4
Compression:
Stored size: 1.17 KB
Contents
# -*- coding: utf-8 -*- require 'minitest/autorun' require 'sixarm_ruby_ramp' class CSVTest < Minitest::Test def test_http_headers h=CSV.http_headers assert_equal('text/csv',h["Content-Type"]) assert_equal("attachment; filename=\"data.csv\"",h["Content-Disposition"]) end def test_http_headers_with_filename h=CSV.http_headers(:filename=>'foo') assert_equal('text/csv',h["Content-Type"]) assert_equal("attachment; filename=\"foo\"",h["Content-Disposition"]) end def test_http_headers_adjust_for_broken_msie_with_request_as_firefox headers = {:request => MockRequest.new('HTTP_USER_AGENT' => 'firefox')} headers = CSV.http_headers_adjust_for_broken_msie(headers) assert_equal(nil,headers[:content_type]) assert_equal(nil,headers[:cache]) end def test_http_headers_adjust_for_broken_msie_with_request_as_msie headers = {:request => MockRequest.new('HTTP_USER_AGENT' => 'msie')} headers = CSV.http_headers_adjust_for_broken_msie(headers) assert_equal('text/plain',headers[:content_type]) assert_equal(false,headers[:cache]) end end class MockRequest def initialize(env) @env=env end def env @env end end
Version data entries
4 entries across 4 versions & 1 rubygems