diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-01-22 01:52:23 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-01-22 01:52:23 +0000 |
commit | ea30f7353be3a977c5ea50d8efaa02acf26dd133 (patch) | |
tree | c59554a191f1f0f1362adf310952db00ba25ceb6 /actionpack/test | |
parent | 039a90f535f8d80d02cabe79a297275977939b10 (diff) | |
download | rails-ea30f7353be3a977c5ea50d8efaa02acf26dd133.tar.gz rails-ea30f7353be3a977c5ea50d8efaa02acf26dd133.tar.bz2 rails-ea30f7353be3a977c5ea50d8efaa02acf26dd133.zip |
Raise a RedirectBackError if redirect_to :back is called when theres no HTTP_REFERER defined (closes #3049) [kevin.clark@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3459 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rwxr-xr-x | actionpack/test/controller/redirect_test.rb | 9 | ||||
-rw-r--r-- | actionpack/test/template/url_helper_test.rb | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb index 4bad5e26ca..11b32d356b 100755 --- a/actionpack/test/controller/redirect_test.rb +++ b/actionpack/test/controller/redirect_test.rb @@ -27,6 +27,8 @@ class RedirectController < ActionController::Base end def rescue_errors(e) raise e end + + def rescue_action(e) raise end protected def dashbord_url(id, message) @@ -76,6 +78,13 @@ class RedirectTest < Test::Unit::TestCase get :redirect_to_back assert_redirect_url "http://www.example.com/coming/from" end + + def test_redirect_to_back_with_no_referer + assert_raises(ActionController::RedirectBackError) { + @request.env["HTTP_REFERER"] = nil + get :redirect_to_back + } + end end module ModuleTest diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 78ad185542..3c830341f0 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -110,14 +110,14 @@ class UrlHelperTest < Test::Unit::TestCase def test_link_tag_using_post_javascript assert_dom_equal( - "<a href=\"http://www.example.com\" onclick=\"f = document.createElement('form'); document.body.appendChild(f); f.method = 'POST'; f.action = this.href; f.submit();return false;\">Hello</a>", + "<a href=\"http://www.example.com\" onclick=\"var f = document.createElement('form'); document.body.appendChild(f); f.method = 'POST'; f.action = this.href; f.submit();return false;\">Hello</a>", link_to("Hello", "http://www.example.com", :post => true) ) end def test_link_tag_using_post_javascript_and_confirm assert_dom_equal( - "<a href=\"http://www.example.com\" onclick=\"if (confirm('Are you serious?')) { f = document.createElement('form'); document.body.appendChild(f); f.method = 'POST'; f.action = this.href; f.submit(); };return false;\">Hello</a>", + "<a href=\"http://www.example.com\" onclick=\"if (confirm('Are you serious?')) { var f = document.createElement('form'); document.body.appendChild(f); f.method = 'POST'; f.action = this.href; f.submit(); };return false;\">Hello</a>", link_to("Hello", "http://www.example.com", :post => true, :confirm => "Are you serious?") ) end |