brynary / webrat

Webrat - Ruby Acceptance Testing for Web applications

This URL has Read+Write access

webrat / spec / private / core / link_spec.rb
f03905e6 » brynary 2008-11-22 Use Webrat::Methods in specs 1 require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
2
3 describe Webrat::Link do
4 # include Webrat::Link
5
6 before do
7 webrat_session = mock(Webrat::TestSession)
8 @link_text_with_nbsp = 'Link' + [0xA0].pack("U") + 'Text'
9 end
10
11 it "should pass through relative urls" do
12 link = Webrat::Link.new(webrat_session, {"href" => "/path"})
13 webrat_session.should_receive(:request_page).with("/path", :get, {})
14 link.click
15 end
16
17 it "shouldnt put base url onto " do
18 url = "https://www.example.com/path"
19 webrat_session.should_receive(:request_page).with(url, :get, {})
20 link = Webrat::Link.new(webrat_session, {"href" => url})
21 link.click
22 end
23
24 end