add Page#links test
parent
f0ac299bb3
commit
534ab0a47a
|
@ -45,4 +45,10 @@ describe "Mechanize Page test" do
|
|||
form = page.form_with({name: "sample_form"})
|
||||
form.name.should eq "sample_form"
|
||||
end
|
||||
|
||||
it "return page links" do
|
||||
agent = Mechanize.new
|
||||
page = agent.get("http://example.com/link")
|
||||
page.links.size.should eq 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,6 +22,19 @@ WebMock.stub(:get, "example.com/form").to_return(body: <<-BODY
|
|||
</html>
|
||||
BODY
|
||||
)
|
||||
|
||||
WebMock.stub(:get, "example.com/link").to_return(body: <<-BODY
|
||||
<html>
|
||||
<head>
|
||||
<title>page_title</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href="http://example.com/">ページのリンク</a>
|
||||
</body>
|
||||
</html>
|
||||
BODY
|
||||
)
|
||||
|
||||
WebMock.stub(:post, "example.com/post_path")
|
||||
.with(body: "name=foo&email=bar", headers: {"Content-Type" => "application/x-www-form-urlencoded"})
|
||||
.to_return(body: "success")
|
||||
|
|
Loading…
Reference in New Issue