aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-15 11:25:35 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-15 11:25:35 +0000
commita02a96226e08557ba6abf70fa80168fe512b8f93 (patch)
tree3b3fdd0a6cdd09d7b909f59b067e0adbcb875488 /railties/test
parent0bb824b7152c0a745dbec8983014b77eedb09726 (diff)
downloadrails-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')
-rw-r--r--railties/test/rails_generator_test.rb2
-rw-r--r--railties/test/webrick_dispatcher_test.rb27
2 files changed, 13 insertions, 16 deletions
diff --git a/railties/test/rails_generator_test.rb b/railties/test/rails_generator_test.rb
index 056372ca47..3a699b04b2 100644
--- a/railties/test/rails_generator_test.rb
+++ b/railties/test/rails_generator_test.rb
@@ -52,7 +52,7 @@ class RailsGeneratorTest < Test::Unit::TestCase
end
def test_instance_missing_generator
- assert_raise(LoadError) {
+ assert_raise(Rails::Generator::GeneratorError) {
Rails::Generator.instance('missing_generator')
}
end
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