webrat/spec/private/core/link_spec.rb

25 lines
690 B
Ruby
Raw Permalink Normal View History

2008-11-23 05:22:49 +00:00
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
describe Webrat::Link do
# include Webrat::Link
before do
2009-08-13 01:42:01 +00:00
webrat_session = mock(Webrat::TestAdapter)
2008-11-23 05:22:49 +00:00
@link_text_with_nbsp = 'Link' + [0xA0].pack("U") + 'Text'
end
2009-04-08 00:30:12 +00:00
2008-11-23 05:22:49 +00:00
it "should pass through relative urls" do
link = Webrat::Link.new(webrat_session, {"href" => "/path"})
webrat_session.should_receive(:request_page).with("/path", :get, {})
link.click
end
2009-04-08 00:30:12 +00:00
2008-11-23 05:22:49 +00:00
it "shouldnt put base url onto " do
url = "https://www.example.com/path"
webrat_session.should_receive(:request_page).with(url, :get, {})
link = Webrat::Link.new(webrat_session, {"href" => url})
link.click
end
2009-04-08 00:30:12 +00:00
2008-11-23 05:22:49 +00:00
end