Sha256: f0c95683a4d58f7e5285c401668571ed91be98580b92ced299cb0886fde4064d

Contents?: true

Size: 854 Bytes

Versions: 2

Compression:

Stored size: 854 Bytes

Contents

$:.unshift File.join(File.dirname(__FILE__), "..", "lib")

require 'test/unit'
require 'rubygems'
require 'mechanize'
require 'test_includes'

class FollowMetaTest < Test::Unit::TestCase
  include TestMethods

  def setup
    @agent = WWW::Mechanize.new
  end

  def test_follow_meta
    page = @agent.get('http://localhost/tc_follow_meta.html')
    assert_equal('http://localhost/tc_follow_meta.html', page.uri.to_s)
    assert_equal(1, page.meta.length)

    @agent.follow_meta_refresh = true
    page = @agent.get('http://localhost/tc_follow_meta.html')
    assert_equal('http://localhost/index.html', page.uri.to_s)
    assert_equal(3, @agent.history.length)
  end

  def test_follow_meta_on_302
    @agent.follow_meta_refresh = true
    assert_nothing_raised {
      @agent.get("http://localhost/response_code?code=302&ct=test/xml")
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mechanize-0.6.10 test/tc_follow_meta.rb
mechanize-0.6.11 test/tc_follow_meta.rb