Skip to content

Commit

Permalink
added another stipulation to the https get test on rails session. Add…
Browse files Browse the repository at this point in the history
…ed a test for the link object with 2 simple tests. 2nd was done while looking for a bug
  • Loading branch information
mike.gaffney committed Oct 22, 2008
1 parent 2fd734f commit f3d508b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -2,4 +2,6 @@ coverage
pkg
doc
ri
email.txt
email.txt
.project
.loadpath
23 changes: 23 additions & 0 deletions spec/webrat/core/link_spec.rb
@@ -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
3 changes: 2 additions & 1 deletion spec/webrat/rails/rails_session_spec.rb
Expand Up @@ -57,10 +57,11 @@
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
Expand Down

0 comments on commit f3d508b

Please sign in to comment.