diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-12-17 00:39:19 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-12-17 00:39:19 +0000 |
commit | 0f6c86ff40d0b0efe672ae76f2b5b536feaf7255 (patch) | |
tree | 61bc174fe871cfccf8d8af39e664959918896b12 /actionpack/test/controller | |
parent | be0c45365c912240b4979150f8c1284916007bca (diff) | |
download | rails-0f6c86ff40d0b0efe672ae76f2b5b536feaf7255.tar.gz rails-0f6c86ff40d0b0efe672ae76f2b5b536feaf7255.tar.bz2 rails-0f6c86ff40d0b0efe672ae76f2b5b536feaf7255.zip |
Added delete_via_redirect and put_via_redirect to integration testing (closes #10497) [philodespotos]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8429 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/integration_test.rb | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index 771e243b00..4213bb4afa 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -49,28 +49,49 @@ class SessionTest < Test::Unit::TestCase assert_equal 200, @session.follow_redirect! end - def test_get_via_redirect - path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" } - - @session.expects(:get).with(path,args,headers) + def test_request_via_redirect_uses_given_method + path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"} + @session.expects(:put).with(path, args, headers) + @session.stubs(:redirect?).returns(false) + @session.request_via_redirect(:put, path, args, headers) + end + def test_request_via_redirect_follows_redirects + path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"} @session.stubs(:redirect?).returns(true, true, false) @session.expects(:follow_redirect!).times(2) + @session.request_via_redirect(:get, path, args, headers) + end + def test_request_via_redirect_returns_status + path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"} + @session.stubs(:redirect?).returns(false) @session.stubs(:status).returns(200) - assert_equal 200, @session.get_via_redirect(path, args, headers) + assert_equal 200, @session.request_via_redirect(:get, path, args, headers) end - def test_post_via_redirect + def test_get_via_redirect path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" } + @session.expects(:request_via_redirect).with(:get, path, args, headers) + @session.get_via_redirect(path, args, headers) + end - @session.expects(:post).with(path,args,headers) + def test_post_via_redirect + path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" } + @session.expects(:request_via_redirect).with(:post, path, args, headers) + @session.post_via_redirect(path, args, headers) + end - @session.stubs(:redirect?).returns(true, true, false) - @session.expects(:follow_redirect!).times(2) + def test_put_via_redirect + path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" } + @session.expects(:request_via_redirect).with(:put, path, args, headers) + @session.put_via_redirect(path, args, headers) + end - @session.stubs(:status).returns(200) - assert_equal 200, @session.post_via_redirect(path, args, headers) + def test_delete_via_redirect + path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" } + @session.expects(:request_via_redirect).with(:delete, path, args, headers) + @session.delete_via_redirect(path, args, headers) end def test_url_for_with_controller |