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:
parent
2fd734f9ff
commit
f3d508b817
|
@ -3,3 +3,5 @@ pkg
|
|||
doc
|
||||
ri
|
||||
email.txt
|
||||
.project
|
||||
.loadpath
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue