Sha256: ba2779d5055229a2c513b888a724c34a242a6bd1884adf8fa8d54a7fcee787ba
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') require 'test/unit' require 'nitro' require 'nitro/render' require 'mega/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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.25.0 | test/nitro/tc_render.rb |
nitro-0.26.0 | test/nitro/tc_render.rb |
nitro-0.27.0 | test/nitro/tc_render.rb |