Skip to content

Commit

Permalink
Merged test_relative_links into test_mechanize
Browse files Browse the repository at this point in the history
  • Loading branch information
drbrain committed Nov 4, 2011
1 parent d2a1b4a commit 5c9afcb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 44 deletions.
1 change: 0 additions & 1 deletion Manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ test/test_multi_select.rb
test/test_pluggable_parser.rb
test/test_redirect_limit_reached.rb
test/test_referer.rb
test/test_relative_links.rb
test/test_robots.rb
test/test_select.rb
test/test_set_fields.rb
40 changes: 33 additions & 7 deletions test/test_mechanize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ def test_click
@mech.history.last.uri.to_s)
end

def test_click_frame
frame = node 'frame', 'src' => '/index.html'
frame = Mechanize::Page::Frame.new frame, @mech, fake_page

@mech.click frame

assert_equal '/index.html', requests.first.path
end

def test_click_frame_hpricot_style
page = @mech.get("http://localhost/frame_test.html")
link = (page/"//frame[@name='frame2']").first
Expand All @@ -111,15 +120,32 @@ def test_click_hpricot_style # HACK move to test_divide in Page
end

def test_click_link
agent = Mechanize.new
agent.user_agent_alias = 'Mac Safari'
page = agent.get("http://localhost/frame_test.html")
link = page.link_with(:text => "Form Test")
link = node 'a', 'href' => '/index.html'
link = Mechanize::Page::Link.new link, @mech, fake_page

agent.click link
@mech.click link

assert_equal("http://localhost/form_test.html",
agent.history.last.uri.to_s)
assert_equal '/index.html', requests.first.path
end

def test_click_link_parent
page = page URI 'http://example/a/index.html'
link = node 'a', 'href' => '../index.html'
link = Mechanize::Page::Link.new link, @mech, page

@mech.click link

assert_equal '/index.html', requests.first.path
end

def test_click_link_parent_extra
page = page URI 'http://example/a/index.html'
link = node 'a', 'href' => '../../index.html'
link = Mechanize::Page::Link.new link, @mech, page

@mech.click link

assert_equal '/index.html', requests.first.path
end

def test_click_link_hpricot_style # HACK move to test_search in Page
Expand Down
36 changes: 0 additions & 36 deletions test/test_relative_links.rb

This file was deleted.

0 comments on commit 5c9afcb

Please sign in to comment.