Sha256: 60757a3cd6eebba7d955283e3434bb011da0c937911c0650470454963f3d9c1a

Contents?: true

Size: 1.4 KB

Versions: 11

Compression:

Stored size: 1.4 KB

Contents

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

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

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

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

  def test_no_referer
    page = @agent.get("http://localhost:#{PORT}/referer")
    assert_equal('', page.body)
  end

  def test_send_referer
    page = @agent.get("http://localhost:#{PORT}/tc_referer.html")
    page = @agent.click page.links.first
    assert_equal("http://localhost:#{PORT}/tc_referer.html", page.body)
  end

  def test_fetch_two
    page1 = @agent.get("http://localhost:#{PORT}/tc_referer.html")
    page2 = @agent.get("http://localhost:#{PORT}/tc_pretty_print.html")
    page = @agent.click page1.links.first
    assert_equal("http://localhost:#{PORT}/tc_referer.html", page.body)
  end

  def test_fetch_two_first
    page1 = @agent.get("http://localhost:#{PORT}/tc_referer.html")
    page2 = @agent.get("http://localhost:#{PORT}/tc_pretty_print.html")
    page = @agent.click page1.links
    assert_equal("http://localhost:#{PORT}/tc_referer.html", page.body)
  end

  def test_post_form
    page1 = @agent.get("http://localhost:#{PORT}/tc_referer.html")
    page2 = @agent.get("http://localhost:#{PORT}/tc_pretty_print.html")
    page = @agent.submit page1.forms.first
    assert_equal("http://localhost:#{PORT}/tc_referer.html", page.body)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mechanize-0.6.1 test/tc_referer.rb
mechanize-0.6.10 test/tc_referer.rb
mechanize-0.6.2 test/tc_referer.rb
mechanize-0.6.4 test/tc_referer.rb
mechanize-0.6.5 test/tc_referer.rb
mechanize-0.6.6 test/tc_referer.rb
mechanize-0.6.7 test/tc_referer.rb
mechanize-0.6.8 test/tc_referer.rb
mechanize-0.6.3 test/tc_referer.rb
mechanize-0.6.9 test/tc_referer.rb
mechanize-0.6.11 test/tc_referer.rb