Rename MerbSession to MerbAdapter
This commit is contained in:
parent
22a06000f9
commit
986682488e
|
@ -91,7 +91,7 @@ module Webrat
|
||||||
# with Merb 1.0.8 until it's updated to use the new Webrat.configure
|
# with Merb 1.0.8 until it's updated to use the new Webrat.configure
|
||||||
# syntax
|
# syntax
|
||||||
if @mode == :merb
|
if @mode == :merb
|
||||||
require("webrat/merb_session")
|
require("webrat/merb_adapter")
|
||||||
else
|
else
|
||||||
require("webrat/#{mode}")
|
require("webrat/#{mode}")
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ module Webrat
|
||||||
when :rails
|
when :rails
|
||||||
RailsSession
|
RailsSession
|
||||||
when :merb
|
when :merb
|
||||||
MerbSession
|
MerbAdapter
|
||||||
when :rack
|
when :rack
|
||||||
RackAdapter
|
RackAdapter
|
||||||
when :rack_test
|
when :rack_test
|
||||||
|
|
|
@ -3,7 +3,7 @@ require "merb-core"
|
||||||
require "webrat/merb_multipart_support"
|
require "webrat/merb_multipart_support"
|
||||||
|
|
||||||
module Webrat
|
module Webrat
|
||||||
class MerbSession #:nodoc:
|
class MerbAdapter #:nodoc:
|
||||||
include Merb::Test::MakeRequest
|
include Merb::Test::MakeRequest
|
||||||
|
|
||||||
# Include Webrat's own version of multipart_post/put because the officially
|
# Include Webrat's own version of multipart_post/put because the officially
|
||||||
|
@ -74,7 +74,7 @@ module Merb #:nodoc:
|
||||||
module Test #:nodoc:
|
module Test #:nodoc:
|
||||||
module RequestHelper #:nodoc:
|
module RequestHelper #:nodoc:
|
||||||
def request(uri, env = {})
|
def request(uri, env = {})
|
||||||
@_webrat_session ||= Webrat::MerbSession.new
|
@_webrat_session ||= Webrat::MerbAdapter.new
|
||||||
@_webrat_session.response = @_webrat_session.request(uri, env)
|
@_webrat_session.response = @_webrat_session.request(uri, env)
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -68,9 +68,9 @@ describe Webrat::Configuration do
|
||||||
end
|
end
|
||||||
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 = Webrat::Configuration.new
|
||||||
config.should_receive(:require).with("webrat/merb_session")
|
config.should_receive(:require).with("webrat/merb_adapter")
|
||||||
config.mode = :merb
|
config.mode = :merb
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
||||||
|
|
||||||
require "webrat/merb"
|
require "webrat/merb"
|
||||||
|
|
||||||
describe Webrat::MerbSession do
|
describe Webrat::MerbAdapter do
|
||||||
it "should not pass empty params if data is and empty hash" 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 = OpenStruct.new
|
||||||
response.status = 200
|
response.status = 200
|
||||||
session.should_receive(:request).with('url', {:params=> nil, :method=>"GET", :headers=>nil}).and_return(response)
|
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|
|
%w{post put delete}.each do |request_method|
|
||||||
it "should call do request with method #{request_method.upcase} for a #{request_method} call" do
|
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 = OpenStruct.new
|
||||||
response.status = 200
|
response.status = 200
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ describe Webrat::MerbSession do
|
||||||
|
|
||||||
%w{post put}.each do |request_method|
|
%w{post put}.each do |request_method|
|
||||||
it "should call do request with method #{request_method.upcase} with a file attachment" do
|
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 = OpenStruct.new
|
||||||
response.status = 200
|
response.status = 200
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ describe Webrat::MerbSession do
|
||||||
|
|
||||||
context "a session with a response" do
|
context "a session with a response" do
|
||||||
before do
|
before do
|
||||||
@session = Webrat::MerbSession.new
|
@session = Webrat::MerbAdapter.new
|
||||||
@response = OpenStruct.new
|
@response = OpenStruct.new
|
||||||
@response.status = 200
|
@response.status = 200
|
||||||
@response.body = 'test response'
|
@response.body = 'test response'
|
Loading…
Reference in New Issue