Sha256: a8b2050e1f9f2e97c79604a4f07729d3c326959daa1e477a0293b433594bc9e5
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
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_redirects_to_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 def test_allows_if_not_ie6 request = Rack::MockRequest.new(Rack::NoIE6.new(TestApp.new, {:redirect => 'http://slashdot.org'})) response = request.get('/', {'HTTP_USER_AGENT' => 'Mozilla/5.0'}) assert_equal "Hi Internets!", response.body end def test_allows_if_no_user_agent_specified request = Rack::MockRequest.new(Rack::NoIE6.new(TestApp.new, {:redirect => 'http://slashdot.org'})) response = request.get('/') 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.1 | test/noie6_test.rb |