diff options
Diffstat (limited to 'railties/test/webrick_dispatcher_test.rb')
-rw-r--r-- | railties/test/webrick_dispatcher_test.rb | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/railties/test/webrick_dispatcher_test.rb b/railties/test/webrick_dispatcher_test.rb index 2c6b51ae62..7f5be65f4b 100644 --- a/railties/test/webrick_dispatcher_test.rb +++ b/railties/test/webrick_dispatcher_test.rb @@ -7,24 +7,21 @@ require 'webrick_server' class ParseUriTest < Test::Unit::TestCase - def test_parse_uri_old_behavior - assert_equal [true, 'forum', 'index', '1'], DispatchServlet.parse_uri('/forum/index/1') - assert_equal [true, 'forum', 'index', nil], DispatchServlet.parse_uri('/forum/index') - assert_equal [true, 'forum', 'index', nil], DispatchServlet.parse_uri('/forum/') - end - - def test_parse_uri_new_behavior - assert_equal [true, 'forum', 'index', '1'], DispatchServlet.parse_uri('/forum/index/1/') - assert_equal [true, 'forum', 'index', nil], DispatchServlet.parse_uri('/forum/index/') - assert_equal [true, 'forum', 'index', nil], DispatchServlet.parse_uri('/forum') + def test_parse_uri_proper_behavior + assert_equal({:id=>"1", :controller=>"forum", :action=>"index"}, DispatchServlet.parse_uri('/forum/index/1')) + assert_equal({:controller=>"forum", :action=>"index"}, DispatchServlet.parse_uri('/forum')) + assert_equal({:controller=>"forum", :action=>"index"}, DispatchServlet.parse_uri('/forum/index')) + assert_equal({:controller=>"forum", :action=>"index"}, DispatchServlet.parse_uri('/forum/')) + assert_equal({:action=>"index", :module=>"admin", :controller=>"forum"}, DispatchServlet.parse_uri('/admin/forum/')) end def test_parse_uri_failures - assert_equal [false, nil, nil, nil], DispatchServlet.parse_uri('/') - assert_equal [false, nil, nil, nil], DispatchServlet.parse_uri('a') - assert_equal [false, nil, nil, nil], DispatchServlet.parse_uri('/forum//') - assert_equal [false, nil, nil, nil], DispatchServlet.parse_uri('/+forum/') - assert_equal [false, nil, nil, nil], DispatchServlet.parse_uri('forum/') + assert_equal false, DispatchServlet.parse_uri('/forum/index/1/') + assert_equal false, DispatchServlet.parse_uri('/') + assert_equal false, DispatchServlet.parse_uri('a') + assert_equal false, DispatchServlet.parse_uri('/forum//') + assert_equal false, DispatchServlet.parse_uri('/+forum/') + assert_equal false, DispatchServlet.parse_uri('forum/') end end |