Sha256: 7093d5fcaf81010fffcb2e862fe5e7f771ccdf1a3a58c4efd1c9129a2a2f4576
Contents?: true
Size: 1.56 KB
Versions: 3
Compression:
Stored size: 1.56 KB
Contents
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') require 'test/unit' require 'nitro' require 'nitro/dispatcher/general' class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all include Nitro class MainController < Controller end class BlogController < Controller end def setup @d = Dispatcher.new({ '/' => MainController, '/blog' => BlogController }) @dxml = Dispatcher.new({ '/' => MainController, '/blog' => BlogController, # FIXME: this is a hack! 'xml:blog' => BlogController }) end def teardown @d = @dxml = nil end def test_initialize d = Dispatcher.new(BlogController) assert_equal BlogController, d.controllers['/'] end def test_dispatch klass, action = @d.dispatch('/blog/list') assert_equal BlogController, klass assert_equal 'list_action', action klass, action = @d.dispatch('/blog/another/very_litle/list') assert_equal BlogController, klass assert_equal 'another__very_litle__list_action', action klass, action = @d.dispatch('/another/litle/list') assert_equal MainController, klass assert_equal 'another__litle__list_action', action klass, action = @d.dispatch('/blog') assert_equal BlogController, klass assert_equal 'index_action', action klass, action, ctype = @d.dispatch('/login') assert_equal MainController, klass assert_equal 'login_action', action klass, action = @d.dispatch('/') assert_equal MainController, klass assert_equal 'index_action', action end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.23.0 | test/nitro/tc_dispatcher.rb |
nitro-0.24.0 | test/nitro/tc_dispatcher.rb |
nitro-0.25.0 | test/nitro/tc_dispatcher.rb |