Browse files

Brought unit tests up to date

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@158 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 0bb824b commit a02a96226e08557ba6abf70fa80168fe512b8f93 @dhh dhh committed Dec 15, 2004
Showing with 13 additions and 16 deletions.
  1. +1 −1 railties/test/rails_generator_test.rb
  2. +12 −15 railties/test/webrick_dispatcher_test.rb
View
2 railties/test/rails_generator_test.rb
@@ -52,7 +52,7 @@ def test_instance_missing_templates
end
def test_instance_missing_generator
- assert_raise(LoadError) {
+ assert_raise(Rails::Generator::GeneratorError) {
Rails::Generator.instance('missing_generator')
}
end
View
27 railties/test/webrick_dispatcher_test.rb
@@ -7,24 +7,21 @@
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

0 comments on commit a02a962

Please sign in to comment.