From 11996a15dce018b5c56411af789ad15121cebd6b Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Thu, 25 Jun 2009 21:13:54 -0400 Subject: [PATCH] Updating to leverage latest rack-test --- lib/webrat/rack.rb | 2 -- lib/webrat/sinatra.rb | 2 +- spec/integration/rack/test/webrat_rack_test.rb | 6 +++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/webrat/rack.rb b/lib/webrat/rack.rb index d139f3a..5682eaf 100644 --- a/lib/webrat/rack.rb +++ b/lib/webrat/rack.rb @@ -1,7 +1,5 @@ require "rack/test" -Rack::Test::DEFAULT_HOST.replace("www.example.com") - module Webrat class RackSession extend Forwardable diff --git a/lib/webrat/sinatra.rb b/lib/webrat/sinatra.rb index 10cdb02..7b33517 100644 --- a/lib/webrat/sinatra.rb +++ b/lib/webrat/sinatra.rb @@ -5,7 +5,7 @@ module Webrat def initialize(context) app = context.respond_to?(:app) ? context.app : Sinatra::Application - super(Rack::Test::Session.new(app)) + super(Rack::Test::Session.new(Rack::MockSession.new(app, "www.example.com"))) end end end diff --git a/spec/integration/rack/test/webrat_rack_test.rb b/spec/integration/rack/test/webrat_rack_test.rb index e3d760d..ebe2d3f 100644 --- a/spec/integration/rack/test/webrat_rack_test.rb +++ b/spec/integration/rack/test/webrat_rack_test.rb @@ -6,6 +6,10 @@ class WebratRackTest < Test::Unit::TestCase include Webrat::Matchers include Webrat::HaveTagMatcher + def build_rack_mock_session + Rack::MockSession.new(app, "www.example.com") + end + def test_visits_pages visit "/" click_link "there" @@ -46,7 +50,7 @@ end class WebratRackSetupTest < Test::Unit::TestCase def test_usable_without_mixin - rack_test_session = Rack::Test::Session.new(app) + rack_test_session = Rack::Test::Session.new(Rack::MockSession.new(app)) adapter = Webrat::RackSession.new(rack_test_session) session = Webrat::Session.new(adapter)