From 561525dd81f1e7632d31d6f7e1df36823ec28c49 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Wed, 12 Aug 2009 20:39:35 -0400 Subject: [PATCH] Rename RackSession to RackAdapter --- lib/webrat/core/session.rb | 4 ++-- lib/webrat/rack.rb | 2 +- lib/webrat/sinatra.rb | 2 +- spec/integration/merb/spec/spec_helper.rb | 2 ++ spec/integration/rack/test/helper.rb | 3 ++- spec/integration/rack/test/webrat_rack_test.rb | 2 +- spec/integration/rails/test/test_helper.rb | 3 ++- spec/integration/sinatra/test/test_helper.rb | 3 ++- 8 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/webrat/core/session.rb b/lib/webrat/core/session.rb index ca1008c..49868b3 100644 --- a/lib/webrat/core/session.rb +++ b/lib/webrat/core/session.rb @@ -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 diff --git a/lib/webrat/rack.rb b/lib/webrat/rack.rb index 5682eaf..89f938d 100644 --- a/lib/webrat/rack.rb +++ b/lib/webrat/rack.rb @@ -1,7 +1,7 @@ require "rack/test" module Webrat - class RackSession + class RackAdapter extend Forwardable def_delegators :@session, :get, :post, :put, :delete diff --git a/lib/webrat/sinatra.rb b/lib/webrat/sinatra.rb index 7b33517..eeb28b6 100644 --- a/lib/webrat/sinatra.rb +++ b/lib/webrat/sinatra.rb @@ -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 diff --git a/spec/integration/merb/spec/spec_helper.rb b/spec/integration/merb/spec/spec_helper.rb index 8042bb3..407dd90 100644 --- a/spec/integration/merb/spec/spec_helper.rb +++ b/spec/integration/merb/spec/spec_helper.rb @@ -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? diff --git a/spec/integration/rack/test/helper.rb b/spec/integration/rack/test/helper.rb index e1ae2f0..9959b35 100644 --- a/spec/integration/rack/test/helper.rb +++ b/spec/integration/rack/test/helper.rb @@ -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| diff --git a/spec/integration/rack/test/webrat_rack_test.rb b/spec/integration/rack/test/webrat_rack_test.rb index ec82973..3b20a23 100644 --- a/spec/integration/rack/test/webrat_rack_test.rb +++ b/spec/integration/rack/test/webrat_rack_test.rb @@ -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" diff --git a/spec/integration/rails/test/test_helper.rb b/spec/integration/rails/test/test_helper.rb index a0d230f..18c79bc 100644 --- a/spec/integration/rails/test/test_helper.rb +++ b/spec/integration/rails/test/test_helper.rb @@ -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 diff --git a/spec/integration/sinatra/test/test_helper.rb b/spec/integration/sinatra/test/test_helper.rb index 61ab13d..7e44db6 100644 --- a/spec/integration/sinatra/test/test_helper.rb +++ b/spec/integration/sinatra/test/test_helper.rb @@ -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