Sha256: 4b94ebf1d6d396cf7823bccf3449eef541bab69b6cdd2ea54533df058fecf4e3
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
require File.join(File.dirname(__FILE__), 'CONFIG.rb') require 'test/unit' require 'nitro' require 'nitro/render' require 'facet/mock' class TestRender < Test::Unit::TestCase # :nodoc: all include Nitro class ContextMock < Mock mock :response_headers, {} mock :host_url, 'http://www.nitroproject.org' 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.nitroproject.org/base/hello', @controller.context.response_headers['location'] # absolute url, use as is. redirect '/main' assert_equal 'http://www.nitroproject.org/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.nitroproject.org/base/edit/Home', @controller.context.response_headers['location'] @controller.base = nil redirect 'edit/Home' assert_equal 'http://www.nitroproject.org/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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.30.0 | test/nitro/tc_render.rb |