Sha256: 8e5c7059116cf2ccd4f4ba99ff38947fc2b8d323dddc340145ad641b11f32fa4
Contents?: true
Size: 853 Bytes
Versions: 6
Compression:
Stored size: 853 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 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 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
6 entries across 6 versions & 1 rubygems