Sha256: c41a11a89cdf18874a3be796eab262975c737f226111d28fd7c998ecd0df15e5
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') require 'test/unit' require 'nitro' require 'nitro/render' require 'glue/mock' class TestRender < Test::Unit::TestCase # :nodoc: all include Nitro class ContextMock < Mock mock :response_headers, {} mock :host_url, 'http://www.nitrohq.com' end class TestController include Nitro::Render end def setup ctx = ContextMock.new @controller = TestController.new(ContextMock.new, '/base') end def teardown @controller = nil end def test_redirect # relative url, the controller base_url is prepended redirect 'hello' assert_equal 'http://www.nitrohq.com/base/hello', @controller.context.response_headers['location'] # absolute url, use as is. redirect '/main' assert_equal 'http://www.nitrohq.com/main', @controller.context.response_headers['location'] # http://, use as is. redirect 'http://www.gmosx.com/info' assert_equal 'http://www.gmosx.com/info', @controller.context.response_headers['location'] # bug. redirect 'edit/Home' assert_equal 'http://www.nitrohq.com/base/edit/Home', @controller.context.response_headers['location'] @controller.base = nil redirect 'edit/Home' assert_equal 'http://www.nitrohq.com/edit/Home', @controller.context.response_headers['location'] end def redirect(*args) begin @controller.send :redirect, *args rescue Nitro::RenderExit end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.23.0 | test/nitro/tc_render.rb |
nitro-0.24.0 | test/nitro/tc_render.rb |