Sha256: 07cbf2609c7c0f0c6b54faf3e3758869f8c736eb8e0049a1389e905f90ebc444

Contents?: true

Size: 822 Bytes

Versions: 1

Compression:

Stored size: 822 Bytes

Contents

require 'test/unit'

require 'rubygems'
require 'rack/mock'

require File.join(File.dirname(__FILE__), '..', 'lib', 'noie6')

class TestApp
  def call(env)
    [200, {}, 'Hi Internets!']
  end
end

class NoieTest < Test::Unit::TestCase
  
  def test_redirects_to_where_it_should_if_ie6
    request = Rack::MockRequest.new(Rack::NoIE6.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
    response = request.get('/', {'HTTP_USER_AGENT' => 'MSIE 6.0' })
    assert_equal 301, response.status
    assert_equal response.location, 'http://slashdot.org'
  end
  
  def test_allows_local_local_urls
    request = Rack::MockRequest.new(Rack::NoIE6.new(TestApp.new, {:redirect => '/foo'}))
    response = request.get('/foo', {'HTTP_USER_AGENT' => 'MSIE 6.0' })    
    assert_equal "Hi Internets!", response.body
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sant0sk1-rack-noie6-1.0.0 test/noie6_test.rb