Updating to leverage latest rack-test

This commit is contained in:
Bryan Helmkamp 2009-06-25 21:13:54 -04:00
parent f2882ef8b2
commit 11996a15dc
3 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,5 @@
require "rack/test" require "rack/test"
Rack::Test::DEFAULT_HOST.replace("www.example.com")
module Webrat module Webrat
class RackSession class RackSession
extend Forwardable extend Forwardable

View File

@ -5,7 +5,7 @@ module Webrat
def initialize(context) def initialize(context)
app = context.respond_to?(:app) ? context.app : Sinatra::Application 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 end
end end

View File

@ -6,6 +6,10 @@ class WebratRackTest < Test::Unit::TestCase
include Webrat::Matchers include Webrat::Matchers
include Webrat::HaveTagMatcher include Webrat::HaveTagMatcher
def build_rack_mock_session
Rack::MockSession.new(app, "www.example.com")
end
def test_visits_pages def test_visits_pages
visit "/" visit "/"
click_link "there" click_link "there"
@ -46,7 +50,7 @@ end
class WebratRackSetupTest < Test::Unit::TestCase class WebratRackSetupTest < Test::Unit::TestCase
def test_usable_without_mixin 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) adapter = Webrat::RackSession.new(rack_test_session)
session = Webrat::Session.new(adapter) session = Webrat::Session.new(adapter)