mechanize.cr/spec/page/link_spec.cr

26 lines
635 B
Crystal
Raw Normal View History

2021-08-19 02:49:53 +02:00
require "../spec_helper"
describe "Mechanize Page Link test" do
it "returns href" do
agent = Mechanize.new
page = agent.get("http://example.com/link")
link = page.links.first
link.href.should eq "http://example.com/"
end
it "returns text" do
agent = Mechanize.new
page = agent.get("http://example.com/link")
link = page.links.first
link.text.should eq "link text"
end
2021-08-19 04:08:49 +02:00
it "is clickable and returns page" do
agent = Mechanize.new
page = agent.get("http://example.com/link")
link = page.links.first
page = link.click
page.uri.to_s.should eq "http://example.com/"
end
2021-08-19 02:49:53 +02:00
end