Sha256: 6b71e2b51f9d497d4565b87c34444323c6a49f0d67cbf86ab81cef499c289e51

Contents?: true

Size: 1.14 KB

Versions: 7

Compression:

Stored size: 1.14 KB

Contents

require 'test/unit'
require 'webget_ruby_ramp'

class CSVTest < Test::Unit::TestCase

  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

7 entries across 7 versions & 1 rubygems

Version Path
webget_ruby_ramp-1.8.2 test/webget_ruby_ramp/csv_test.rb
webget_ruby_ramp-1.8.0 test/webget_ruby_ramp/csv_test.rb
webget_ruby_ramp-1.7.8 test/webget_ruby_ramp/csv_test.rb
webget_ruby_ramp-1.7.7 test/webget_ruby_ramp/csv_test.rb
webget_ruby_ramp-1.7.6 test/webget_ruby_ramp/csv_test.rb
webget_ruby_ramp-1.7.5 test/webget_ruby_ramp/csv_test.rb
webget_ruby_ramp-1.7.4 test/webget_ruby_ramp/csv_test.rb