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 when :merb
MerbSession MerbSession
when :rack when :rack
RackSession RackAdapter
when :rack_test when :rack_test
warn("The :rack_test mode is deprecated. Please use :rack instead") warn("The :rack_test mode is deprecated. Please use :rack instead")
require "webrat/rack" require "webrat/rack"
RackSession RackAdapter
when :sinatra when :sinatra
warn("The :sinatra mode is deprecated. Please use :rack instead") warn("The :sinatra mode is deprecated. Please use :rack instead")
SinatraSession SinatraSession

View File

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

View File

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

View File

@ -1,5 +1,7 @@
require "rubygems" require "rubygems"
$LOAD_PATH.unshift File.dirname(__FILE__) + "/../../../../lib"
# Add the local gems dir if found within the app root; any dependencies loaded # 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. # 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? 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 "rack/test"
# require "redgreen" # require "redgreen"
require File.dirname(__FILE__) + "/../../../../lib/webrat" $LOAD_PATH.unshift File.dirname(__FILE__) + "/../../../../lib"
require "webrat"
require File.dirname(__FILE__) + "/../app" require File.dirname(__FILE__) + "/../app"
Webrat.configure do |config| Webrat.configure do |config|

View File

@ -62,7 +62,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(Rack::MockSession.new(app)) 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 = Webrat::Session.new(adapter)
session.visit "/foo" session.visit "/foo"

View File

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

View File

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