Permalink
Browse files

Added tests from Andrew Whites fix [#1385 state:committed]

  • Loading branch information...
1 parent b80fa81 commit 6db78e8c02442080d2be93faeeb42be97b09fb53 @dhh dhh committed Feb 5, 2009
Showing with 23 additions and 0 deletions.
  1. +2 −0 actionpack/CHANGELOG
  2. +21 −0 actionpack/test/template/url_helper_test.rb
View
2 actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*Edge*
+* Fix a syntax error in current_page?() that was prevent matches against URL's with multiple query parameters #1385, #1868 [chris finne/Andrew White]
+
* Added localized rescue template when I18n.locale is set (ex: public/404.da.html) #1835 [José Valim]
View
21 actionpack/test/template/url_helper_test.rb
@@ -252,6 +252,27 @@ def test_link_to_if
assert_equal "Showing", link_to_if(false, "Showing", :action => "show", :controller => "weblog", :id => 1)
end
+ def test_current_page_with_simple_url
+ @controller.request = RequestMock.new("http://www.example.com/weblog/show")
+ @controller.url = "http://www.example.com/weblog/show"
+ assert current_page?({ :action => "show", :controller => "weblog" })
+ assert current_page?("http://www.example.com/weblog/show")
+ end
+
+ def test_current_page_ignoring_params
+ @controller.request = RequestMock.new("http://www.example.com/weblog/show?order=desc&page=1")
+ @controller.url = "http://www.example.com/weblog/show?order=desc&page=1"
+ assert current_page?({ :action => "show", :controller => "weblog" })
+ assert current_page?("http://www.example.com/weblog/show")
+ end
+
+ def test_current_page_with_params_that_match
+ @controller.request = RequestMock.new("http://www.example.com/weblog/show?order=desc&page=1")
+ @controller.url = "http://www.example.com/weblog/show?order=desc&page=1"
+ assert current_page?({ :action => "show", :controller => "weblog", :order => "desc", :page => "1" })
+ assert current_page?("http://www.example.com/weblog/show?order=desc&page=1")
+ end
+
def test_link_unless_current
@controller.request = RequestMock.new("http://www.example.com/weblog/show")
@controller.url = "http://www.example.com/weblog/show"

0 comments on commit 6db78e8

Please sign in to comment.