Sha256: 317268a015ca3168b03713d44877655a3cf1da151a340b7c414ac9906239f5bd

Contents?: true

Size: 640 Bytes

Versions: 8

Compression:

Stored size: 640 Bytes

Contents

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

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

class MechSubclass < WWW::Mechanize
  def set_headers(uri, request, cur_page)
    super(uri, request, cur_page)
    request.add_field('Cookie', 'name=Aaron')
    request
  end
end

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

  def setup
    @agent = MechSubclass.new
  end

  def test_send_cookie
    page = @agent.get("http://localhost:#{PORT}/send_cookies")
    assert_equal(1, page.links.length)
    assert_not_nil(page.links.find { |l| l.text == "name:Aaron" })
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mechanize-0.6.10 test/tc_subclass.rb
mechanize-0.6.5 test/tc_subclass.rb
mechanize-0.6.8 test/tc_subclass.rb
mechanize-0.6.11 test/tc_subclass.rb
mechanize-0.6.4 test/tc_subclass.rb
mechanize-0.6.6 test/tc_subclass.rb
mechanize-0.6.7 test/tc_subclass.rb
mechanize-0.6.9 test/tc_subclass.rb