File: tc_encoded_links.rb

package info (click to toggle)
libwww-mechanize-ruby 0.7.6-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 752 kB
  • ctags: 607
  • sloc: ruby: 4,883; makefile: 4
file content (20 lines) | stat: -rw-r--r-- 567 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require File.dirname(__FILE__) + "/helper"

class TestEncodedLinks < Test::Unit::TestCase
  def setup
    @agent = WWW::Mechanize.new
    @page = @agent.get("http://localhost/tc_encoded_links.html")
  end

  def test_click_link
    link = @page.links.first
    assert_equal('/form_post?a=b&b=c', link.href)
    page = @agent.click(link)
    assert_equal("http://localhost/form_post?a=b&b=c", page.uri.to_s)
  end

  def test_hpricot_link
    page = @agent.click(@page.search('a').first)
    assert_equal("http://localhost/form_post?a=b&b=c", page.uri.to_s)
  end
end