add page#forms test

This commit is contained in:
Kanezoh 2021-06-11 09:17:59 +09:00
parent 0b130e7da7
commit f09d0715a3

View File

@ -10,7 +10,13 @@ WebMock.stub(:get, "html_example.com").to_return(body:
<head> <head>
<title>page_title</title> <title>page_title</title>
</head> </head>
<body></body> <body>
<form action="post_path">
<input type="text" name="name">
<input type="text" name="email">
<input type="submit" value="">
</form>
</body>
</html> </html>
BODY BODY
) )
@ -39,4 +45,11 @@ describe "Mechanize Page test" do
page = agent.get("http://html_example.com") page = agent.get("http://html_example.com")
page.title.should eq "page_title" page.title.should eq "page_title"
end end
it "return page forms" do
agent = Mechanize.new
page = agent.get("http://html_example.com")
page.forms.size.should eq 1
page.forms.first.action.should eq "post_path"
end
end end