From 986682488efbbb9e2380ba5e1105d9291b6cc59e Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Wed, 12 Aug 2009 20:50:55 -0400 Subject: [PATCH] Rename MerbSession to MerbAdapter --- lib/webrat/core/configuration.rb | 2 +- lib/webrat/core/session.rb | 2 +- lib/webrat/{merb_session.rb => merb_adapter.rb} | 4 ++-- spec/private/core/configuration_spec.rb | 4 ++-- .../{merb_session_spec.rb => merb_adapter_spec.rb} | 10 +++++----- 5 files changed, 11 insertions(+), 11 deletions(-) rename lib/webrat/{merb_session.rb => merb_adapter.rb} (95%) rename spec/private/merb/{merb_session_spec.rb => merb_adapter_spec.rb} (91%) diff --git a/lib/webrat/core/configuration.rb b/lib/webrat/core/configuration.rb index 2cd58c0..c035246 100755 --- a/lib/webrat/core/configuration.rb +++ b/lib/webrat/core/configuration.rb @@ -91,7 +91,7 @@ module Webrat # with Merb 1.0.8 until it's updated to use the new Webrat.configure # syntax if @mode == :merb - require("webrat/merb_session") + require("webrat/merb_adapter") else require("webrat/#{mode}") end diff --git a/lib/webrat/core/session.rb b/lib/webrat/core/session.rb index e194df8..81288db 100644 --- a/lib/webrat/core/session.rb +++ b/lib/webrat/core/session.rb @@ -21,7 +21,7 @@ module Webrat when :rails RailsSession when :merb - MerbSession + MerbAdapter when :rack RackAdapter when :rack_test diff --git a/lib/webrat/merb_session.rb b/lib/webrat/merb_adapter.rb similarity index 95% rename from lib/webrat/merb_session.rb rename to lib/webrat/merb_adapter.rb index cd9c300..65caa2a 100644 --- a/lib/webrat/merb_session.rb +++ b/lib/webrat/merb_adapter.rb @@ -3,7 +3,7 @@ require "merb-core" require "webrat/merb_multipart_support" module Webrat - class MerbSession #:nodoc: + class MerbAdapter #:nodoc: include Merb::Test::MakeRequest # Include Webrat's own version of multipart_post/put because the officially @@ -74,7 +74,7 @@ module Merb #:nodoc: module Test #:nodoc: module RequestHelper #:nodoc: def request(uri, env = {}) - @_webrat_session ||= Webrat::MerbSession.new + @_webrat_session ||= Webrat::MerbAdapter.new @_webrat_session.response = @_webrat_session.request(uri, env) end end diff --git a/spec/private/core/configuration_spec.rb b/spec/private/core/configuration_spec.rb index bb05b21..5511ec3 100755 --- a/spec/private/core/configuration_spec.rb +++ b/spec/private/core/configuration_spec.rb @@ -68,9 +68,9 @@ describe Webrat::Configuration do end end - it "should require merb_session when in merb mode" do + it "should require merb_adapter when in merb mode" do config = Webrat::Configuration.new - config.should_receive(:require).with("webrat/merb_session") + config.should_receive(:require).with("webrat/merb_adapter") config.mode = :merb end diff --git a/spec/private/merb/merb_session_spec.rb b/spec/private/merb/merb_adapter_spec.rb similarity index 91% rename from spec/private/merb/merb_session_spec.rb rename to spec/private/merb/merb_adapter_spec.rb index 06b4b99..9257e35 100644 --- a/spec/private/merb/merb_session_spec.rb +++ b/spec/private/merb/merb_adapter_spec.rb @@ -2,9 +2,9 @@ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper") require "webrat/merb" -describe Webrat::MerbSession do +describe Webrat::MerbAdapter do it "should not pass empty params if data is and empty hash" do - session = Webrat::MerbSession.new + session = Webrat::MerbAdapter.new response = OpenStruct.new response.status = 200 session.should_receive(:request).with('url', {:params=> nil, :method=>"GET", :headers=>nil}).and_return(response) @@ -13,7 +13,7 @@ describe Webrat::MerbSession do %w{post put delete}.each do |request_method| it "should call do request with method #{request_method.upcase} for a #{request_method} call" do - session = Webrat::MerbSession.new + session = Webrat::MerbAdapter.new response = OpenStruct.new response.status = 200 @@ -24,7 +24,7 @@ describe Webrat::MerbSession do %w{post put}.each do |request_method| it "should call do request with method #{request_method.upcase} with a file attachment" do - session = Webrat::MerbSession.new + session = Webrat::MerbAdapter.new response = OpenStruct.new response.status = 200 @@ -43,7 +43,7 @@ describe Webrat::MerbSession do context "a session with a response" do before do - @session = Webrat::MerbSession.new + @session = Webrat::MerbAdapter.new @response = OpenStruct.new @response.status = 200 @response.body = 'test response'