added another stipulation to the https get test on rails session. Added a test for the link object with 2 simple tests. 2nd was done while looking for a bug

This commit is contained in:
mike.gaffney 2008-10-21 23:55:58 -05:00
parent 2fd734f9ff
commit f3d508b817
3 changed files with 28 additions and 2 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@ pkg
doc
ri
email.txt
.project
.loadpath

23
spec/webrat/core/link_spec.rb Executable file
View File

@ -0,0 +1,23 @@
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
describe Webrat::Link do
# include Webrat::Link
before do
@session = mock(Webrat::TestSession)
end
it "should pass through relative urls" do
link = Webrat::Link.new(@session, {"href" => "/path"})
@session.should_receive(:request_page).with("/path", :get, {})
link.click
end
it "shouldnt put base url onto " do
url = "https://www.example.com/path"
@session.should_receive(:request_page).with(url, :get, {})
link = Webrat::Link.new(@session, {"href" => url})
link.click
end
end

View File

@ -57,10 +57,11 @@ describe Webrat::RailsSession do
end
context "the URL is https://" do
it "should call #https! with true before the request" do
it "should call #https! with true before the request and just pass on the path" do
integration_session = mock("integration session", :get_via_redirect => nil)
rails_session = Webrat::RailsSession.new(integration_session)
integration_session.should_receive(:https!).with(true)
integration_session.should_receive(:get_via_redirect).with("/url", "data", "headers")
rails_session.get("https://www.example.com/url", "data", "headers")
end
end