diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2009-02-05 20:37:57 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2009-02-05 20:37:57 +0100 |
commit | 6db78e8c02442080d2be93faeeb42be97b09fb53 (patch) | |
tree | d8e4d846f5c0949e4d280e82de8092f93997343a /actionpack/test | |
parent | b80fa817d422e6c7ab743f4aa5cb4315b48ec7d5 (diff) | |
download | rails-6db78e8c02442080d2be93faeeb42be97b09fb53.tar.gz rails-6db78e8c02442080d2be93faeeb42be97b09fb53.tar.bz2 rails-6db78e8c02442080d2be93faeeb42be97b09fb53.zip |
Added tests from Andrew Whites fix [#1385 state:committed]
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/url_helper_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 2950b4b60c..e7799fb204 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -252,6 +252,27 @@ class UrlHelperTest < ActionView::TestCase 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" |