Sha256: 68c31e9c2c80e2a8644fc51241510b5350a922ce984f549114fb71e71e2757a6
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
# Copyright (c) 2005 Zed A. Shaw # You can redistribute it and/or modify it under the same terms as Ruby. # # Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html # for more information. require 'test/testhelp' class RedirectHandlerTest < Test::Unit::TestCase def setup @port = process_based_port redirect_test_io do @server = Mongrel::HttpServer.new('127.0.0.1', @port) end @server.run @client = Net::HTTP.new('127.0.0.1', @port) end def teardown @server.stop(true) end def test_simple_redirect tester = Mongrel::RedirectHandler.new('/yo') @server.register("/test", tester) sleep(1) res = @client.request_get('/test') assert res != nil, "Didn't get a response" assert_equal ['/yo'], res.get_fields('Location') end def test_rewrite tester = Mongrel::RedirectHandler.new(/(\w+)/, '+\1+') @server.register("/test", tester) sleep(1) res = @client.request_get('/test/something') assert_equal ['/+test+/+something+'], res.get_fields('Location') end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
headius-mongrel-1.1.6.1 | test/test_redirect_handler.rb |
mongrel-1.1.5-x86-mingw32 | test/test_redirect_handler.rb |