Sha256: 71d4fa9533b1ec16db85db65cbf3c7bcdc04004ee042d769435ce4ae4505b9d9

Contents?: true

Size: 510 Bytes

Versions: 9

Compression:

Stored size: 510 Bytes

Contents

require File.dirname(__FILE__) + "/helper"

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
  def setup
    @agent = MechSubclass.new
  end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mechanize-0.7.1 test/tc_subclass.rb
mechanize-0.7.4 test/tc_subclass.rb
mechanize-0.7.7 test/test_subclass.rb
mechanize-0.7.0 test/tc_subclass.rb
mechanize-0.7.2 test/tc_subclass.rb
mechanize-0.7.3 test/tc_subclass.rb
mechanize-0.7.5 test/tc_subclass.rb
mechanize-0.7.6 test/tc_subclass.rb
mechanize-0.7.8 test/test_subclass.rb