Sha256: 9ff5ed87dee882f7cdcb98daba97c547c8008773194957b7a514d3c4c23d1822
Contents?: true
Size: 878 Bytes
Versions: 1
Compression:
Stored size: 878 Bytes
Contents
$:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'test/unit' require 'rubygems' require 'mechanize' require 'test_includes' class FormsMechTest < Test::Unit::TestCase include TestMethods def test_redirect agent = WWW::Mechanize.new { |a| a.log = Logger.new(nil) } agent.get("http://localhost:#{@port}/response_code?code=301") assert_equal("http://localhost:#{@port}/index.html", agent.current_page.uri.to_s) agent.get("http://localhost:#{@port}/response_code?code=302") assert_equal("http://localhost:#{@port}/index.html", agent.current_page.uri.to_s) end def test_error agent = WWW::Mechanize.new { |a| a.log = Logger.new(nil) } begin agent.get("http://localhost:#{@port}/response_code?code=500") rescue WWW::ResponseCodeError => err assert_equal("500", err.response_code) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mechanize-0.4.1 | test/tc_response_code.rb |