diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-02 08:33:30 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-02 08:33:30 +0000 |
commit | 00121b2ca2f795d16b54295cb9fc0fdcbbe50dd8 (patch) | |
tree | 08cac8f1215cfb0b4cc6f2a7dfd08907e861cb5e /actionpack/test/controller | |
parent | aec31cd09f12fcda128582ef5bfbe25bb87db644 (diff) | |
download | rails-00121b2ca2f795d16b54295cb9fc0fdcbbe50dd8.tar.gz rails-00121b2ca2f795d16b54295cb9fc0fdcbbe50dd8.tar.bz2 rails-00121b2ca2f795d16b54295cb9fc0fdcbbe50dd8.zip |
Added :method option to verify for ensuring that either GET, POST, etc is allowed #984 [Jamis Buck]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1060 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/verification_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/controller/verification_test.rb b/actionpack/test/controller/verification_test.rb index 07dc73eb1c..3b547885c1 100644 --- a/actionpack/test/controller/verification_test.rb +++ b/actionpack/test/controller/verification_test.rb @@ -18,6 +18,9 @@ class VerificationTest < Test::Unit::TestCase verify :only => [:multi_one, :multi_two], :session => %w( one two ), :redirect_to => { :action => "unguarded" } + verify :only => :guarded_by_method, :method => :post, + :redirect_to => { :action => "unguarded" } + def guarded_one render_text "#{@params["one"]}" end @@ -42,9 +45,15 @@ class VerificationTest < Test::Unit::TestCase render_text "#{@session["two"]}:#{@session["one"]}" end + def guarded_by_method + render_text "#{@request.method}" + end + def unguarded render_text "#{@params["one"]}" end + + def rescue_action(e) raise end end def setup @@ -134,4 +143,16 @@ class VerificationTest < Test::Unit::TestCase process "multi_two" assert_redirected_to :action => "unguarded" end + + def test_guarded_by_method_with_prereqs + @request.env["REQUEST_METHOD"] = "POST" + process "guarded_by_method" + assert_equal "post", @response.body + end + + def test_guarded_by_method_without_prereqs + @request.env["REQUEST_METHOD"] = "GET" + process "guarded_by_method" + assert_redirected_to :action => "unguarded" + end end |