Sha256: 4760cf09f2ffb27a8acf7c7b25abc605949dd0f627f7aafe68a7693fd76b9eb1
Contents?: true
Size: 917 Bytes
Versions: 3
Compression:
Stored size: 917 Bytes
Contents
$:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'test/unit' require 'rubygems' require 'mechanize' require 'test_includes' class ResponseCodeMechTest < Test::Unit::TestCase include TestMethods def setup @agent = WWW::Mechanize.new { |a| a.log = Logger.new(nil) } end def test_redirect @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::Mechanize::ResponseCodeError => err assert_equal("500", err.response_code) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mechanize-0.5.1 | test/tc_response_code.rb |
mechanize-0.5.0 | test/tc_response_code.rb |
mechanize-0.5.2 | test/tc_response_code.rb |