Sha256: 8cec4ea4f7528bbb46362c884d87b3762f02ea476e7344a29932299a6cb3062f
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), "helper")) class TestRedirectNotGetOrHead < Test::Unit::TestCase def setup @agent = Mechanize.new end def test_to_s page = MechTestHelper.fake_page(@agent) error = Mechanize::RedirectNotGetOrHeadError.new(page, :put) assert_match(/put/, error.to_s) end def test_head_redirect_results_in_head_request page = @agent.head('http://localhost/redirect') assert_equal(page.uri.to_s, 'http://localhost/verb') assert_equal(page.body, "method: HEAD") end def test_get_redirect_results_in_get_request page = @agent.get('http://localhost/redirect') assert_equal(page.uri.to_s, 'http://localhost/verb') assert_equal(page.body, "method: GET") end def test_post_redirect_results_in_get_request page = @agent.post('http://localhost/redirect') assert_equal(page.uri.to_s, 'http://localhost/verb') assert_equal(page.body, "method: GET") end def test_put_redirect_results_in_get_request page = @agent.put('http://localhost/redirect', 'foo') assert_equal(page.uri.to_s, 'http://localhost/verb') assert_equal(page.body, "method: GET") end def test_delete_redirect_results_in_get_request page = @agent.delete('http://localhost/redirect') assert_equal(page.uri.to_s, 'http://localhost/verb') assert_equal(page.body, "method: GET") end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
kitamomonga-mechanize-0.9.3.20090724215219 | test/test_redirect_verb_handling.rb |
tenderlove-mechanize-0.9.3.20090911221705 | test/test_redirect_verb_handling.rb |