Sha256: 1be16450843aa015f07bfee22e4802b75b733f3ef27020b44381ddea23cce326

Contents?: true

Size: 702 Bytes

Versions: 13

Compression:

Stored size: 702 Bytes

Contents

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

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

class Area
  attr_reader :name

  def initialize(node)
    @name = node.attributes['name']
  end
end

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

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

  def test_watches
    page = @agent.get("http://localhost:#{PORT}/find_link.html")
    page.watch_for_set = { 'area' => Area }
    watches = page.watches
    assert_equal(3, watches['area'].size)
    assert_nil(watches['area'][0].name)
    assert_equal('Marty', watches['area'][1].name)
    assert_nil(watches['area'][2].name)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mechanize-0.5.3 test/tc_watches.rb
mechanize-0.5.0 test/tc_watches.rb
mechanize-0.5.1 test/tc_watches.rb
mechanize-0.5.2 test/tc_watches.rb
mechanize-0.5.4 test/tc_watches.rb
mechanize-0.6.0 test/tc_watches.rb
mechanize-0.6.1 test/tc_watches.rb
mechanize-0.6.7 test/tc_watches.rb
mechanize-0.6.2 test/tc_watches.rb
mechanize-0.6.6 test/tc_watches.rb
mechanize-0.6.3 test/tc_watches.rb
mechanize-0.6.4 test/tc_watches.rb
mechanize-0.6.5 test/tc_watches.rb