Sha256: e2a485eba63eb7f10bf1288518aff22e0ae60e83c1428aea9cfc0ab18a281810
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), "helper")) class ResponseCodeMechTest < Test::Unit::TestCase def setup @agent = Mechanize.new end def test_eof_error_loop assert_raises(EOFError) { @agent.get("http://localhost/http_headers?Content-Length=300") } end def test_redirect @agent.get("http://localhost/response_code?code=300") assert_equal("http://localhost/index.html", @agent.current_page.uri.to_s) @agent.get("http://localhost/response_code?code=301") assert_equal("http://localhost/index.html", @agent.current_page.uri.to_s) @agent.get("http://localhost/response_code?code=302") assert_equal("http://localhost/index.html", @agent.current_page.uri.to_s) @agent.get("http://localhost/response_code?code=303") assert_equal("http://localhost/index.html", @agent.current_page.uri.to_s) @agent.get("http://localhost/response_code?code=307") assert_equal("http://localhost/index.html", @agent.current_page.uri.to_s) end def test_do_not_follow_redirect @agent.redirect_ok = false @agent.get("http://localhost/response_code?code=302") assert_equal("http://localhost/response_code?code=302", @agent.current_page.uri.to_s) end def test_error @agent = Mechanize.new begin @agent.get("http://localhost/response_code?code=500") rescue Mechanize::ResponseCodeError => err assert_equal("500", err.response_code) end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
kitamomonga-mechanize-0.9.3.20090724215219 | test/test_response_code.rb |
tenderlove-mechanize-0.9.3.20090911221705 | test/test_response_code.rb |