diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-15 11:25:35 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-15 11:25:35 +0000 |
commit | a02a96226e08557ba6abf70fa80168fe512b8f93 (patch) | |
tree | 3b3fdd0a6cdd09d7b909f59b067e0adbcb875488 /railties/test/webrick_dispatcher_test.rb | |
parent | 0bb824b7152c0a745dbec8983014b77eedb09726 (diff) | |
download | rails-a02a96226e08557ba6abf70fa80168fe512b8f93.tar.gz rails-a02a96226e08557ba6abf70fa80168fe512b8f93.tar.bz2 rails-a02a96226e08557ba6abf70fa80168fe512b8f93.zip |
Brought unit tests up to date
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@158 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
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 |