diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 5c75ccf203..caef1a2770 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -8,7 +8,9 @@ * Improve Text Helper test coverage. #7274 [Rob Sanheim, Josh Peek] -* Improve helper test coverage. #7215, #7233, #7234, #7235, #7236, #7237, #7238, #7241, #7243, #7244 [Rich Collins, Josh Peek] +* Improve helper test coverage. #7208, #7212, #7215, #7233, #7234, #7235, #7236, #7237, #7238, #7241, #7243, #7244 [Rich Collins, Josh Peek] + +* Improve UrlRewriter tests. #7207 [Rich Collins] * Resources: url_for([parent, child]) generates /parents/1/children/2 for the nested resource. Likewise with the other simply helpful methods like form_for and link_to. #6432 [mhw, Jonathan Vaught, lotswholetime] diff --git a/actionpack/test/controller/url_rewriter_test.rb b/actionpack/test/controller/url_rewriter_test.rb index 9ca482f79c..1c746b7aee 100644 --- a/actionpack/test/controller/url_rewriter_test.rb +++ b/actionpack/test/controller/url_rewriter_test.rb @@ -1,5 +1,7 @@ require File.dirname(__FILE__) + '/../abstract_unit' +ActionController::UrlRewriter + class UrlRewriterTests < Test::Unit::TestCase def setup @request = ActionController::TestRequest.new @@ -63,6 +65,14 @@ class UrlRewriterTests < Test::Unit::TestCase u = @rewriter.rewrite(:only_path => false, :overwrite_params => {:list_page => 2}) assert_equal 'http://test.host/search/list?list_page=2', u end + + def test_to_str + @params[:controller] = 'hi' + @params[:action] = 'bye' + @request.parameters[:id] = '2' + + assert_equal 'http://, test.host, /, hi, bye, {"id"=>"2"}', @rewriter.to_str + end end class UrlWriterTests < Test::Unit::TestCase diff --git a/actionpack/test/template/active_record_helper_test.rb b/actionpack/test/template/active_record_helper_test.rb index 5eab1c8525..4a85ae1751 100644 --- a/actionpack/test/template/active_record_helper_test.rb +++ b/actionpack/test/template/active_record_helper_test.rb @@ -28,7 +28,16 @@ class ActiveRecordHelperTest < Test::Unit::TestCase @post = Post.new def @post.errors Class.new { - def on(field) field == "author_name" || field == "body" end + def on(field) + case field.to_s + when "author_name" + "can't be empty" + when "body" + true + else + false + end + end def empty?() false end def count() 1 end def full_messages() [ "Author name can't be empty" ] end @@ -52,7 +61,7 @@ class ActiveRecordHelperTest < Test::Unit::TestCase @post.secret = 1 @post.written_on = Date.new(2004, 6, 15) end - + def setup_user @user = User.new def @user.errors @@ -95,7 +104,7 @@ class ActiveRecordHelperTest < Test::Unit::TestCase %(), input("post", "title") ) end - + def test_text_area_with_errors assert_dom_equal( %(
), @@ -109,7 +118,7 @@ class ActiveRecordHelperTest < Test::Unit::TestCase text_field("post", "author_name") ) end - + def test_form_with_string assert_dom_equal( %(), @@ -129,7 +138,7 @@ class ActiveRecordHelperTest < Test::Unit::TestCase form("post") ) end - + def test_form_with_date silence_warnings do def Post.content_columns() [ Column.new(:date, "written_on", "Written on") ] end @@ -152,26 +161,30 @@ class ActiveRecordHelperTest < Test::Unit::TestCase form("post") ) end - + def test_error_for_block assert_dom_equal %(There were problems with the following fields:
There were problems with the following fields:
There were problems with the following fields:
There were problems with the following fields:
There were problems with the following fields:
There were problems with the following fields:
There were problems with the following fields: