Rename RackSession to RackAdapter

This commit is contained in:
Bryan Helmkamp 2009-08-12 20:39:35 -04:00
parent 3670b19f66
commit 561525dd81
8 changed files with 13 additions and 8 deletions

View File

@ -19,11 +19,11 @@ module Webrat
when :merb
MerbSession
when :rack
RackSession
RackAdapter
when :rack_test
warn("The :rack_test mode is deprecated. Please use :rack instead")
require "webrat/rack"
RackSession
RackAdapter
when :sinatra
warn("The :sinatra mode is deprecated. Please use :rack instead")
SinatraSession

View File

@ -1,7 +1,7 @@
require "rack/test"
module Webrat
class RackSession
class RackAdapter
extend Forwardable
def_delegators :@session, :get, :post, :put, :delete

View File

@ -1,7 +1,7 @@
require "webrat/rack"
module Webrat
class SinatraSession < RackSession
class SinatraSession < RackAdapter
def initialize(context)
app = context.respond_to?(:app) ? context.app : Sinatra::Application

View File

@ -1,5 +1,7 @@
require "rubygems"
$LOAD_PATH.unshift File.dirname(__FILE__) + "/../../../../lib"
# Add the local gems dir if found within the app root; any dependencies loaded
# hereafter will try to load from the local gems before loading system gems.
if (local_gem_dir = File.join(File.dirname(__FILE__), '..', 'gems')) && $BUNDLE.nil?

View File

@ -3,7 +3,8 @@ require "test/unit"
require "rack/test"
# require "redgreen"
require File.dirname(__FILE__) + "/../../../../lib/webrat"
$LOAD_PATH.unshift File.dirname(__FILE__) + "/../../../../lib"
require "webrat"
require File.dirname(__FILE__) + "/../app"
Webrat.configure do |config|

View File

@ -62,7 +62,7 @@ end
class WebratRackSetupTest < Test::Unit::TestCase
def test_usable_without_mixin
rack_test_session = Rack::Test::Session.new(Rack::MockSession.new(app))
adapter = Webrat::RackSession.new(rack_test_session)
adapter = Webrat::RackAdapter.new(rack_test_session)
session = Webrat::Session.new(adapter)
session.visit "/foo"

View File

@ -7,7 +7,8 @@ require 'test_help'
# rescue MissingSourceFile
# end
require File.dirname(__FILE__) + "/../../../../lib/webrat"
$LOAD_PATH.unshift File.dirname(__FILE__) + "/../../../../lib"
require "webrat"
Webrat.configure do |config|
config.mode = ENV['WEBRAT_INTEGRATION_MODE'].to_sym

View File

@ -2,7 +2,8 @@ require "rubygems"
require "test/unit"
# require "redgreen"
require File.dirname(__FILE__) + "/../../../../lib/webrat"
$LOAD_PATH.unshift File.dirname(__FILE__) + "/../../../../lib"
require "webrat"
Webrat.configure do |config|
config.mode = :sinatra