diff --git a/lib/webrat/core/methods.rb b/lib/webrat/core/methods.rb index d205cb3..2326b25 100644 --- a/lib/webrat/core/methods.rb +++ b/lib/webrat/core/methods.rb @@ -5,7 +5,7 @@ module Webrat meths.each do |meth| self.class_eval <<-RUBY def #{meth}(*args, &blk) - @session ||= ::Webrat::Session.new + @session ||= ::Webrat::MerbSession.new @session.#{meth}(*args, &blk) end RUBY diff --git a/lib/webrat/merb.rb b/lib/webrat/merb.rb index 0c62d73..b294ff9 100644 --- a/lib/webrat/merb.rb +++ b/lib/webrat/merb.rb @@ -8,7 +8,7 @@ require "merb-core" HashWithIndifferentAccess = Mash module Webrat - class Session + class MerbSession < Session include Merb::Test::MakeRequest attr_accessor :response @@ -55,7 +55,7 @@ module Merb module Test module RequestHelper def request(uri, env = {}) - @session ||= Webrat::Session.new + @session ||= Webrat::MerbSession.new @session.response = @session.request(uri, env) end @@ -68,7 +68,7 @@ end class Merb::Test::RspecStory def browser - @browser ||= Webrat::Session.new + @browser ||= Webrat::MerbSession.new end end diff --git a/spec/webrat/merb/session_spec.rb b/spec/webrat/merb/session_spec.rb index 237413d..641caa4 100644 --- a/spec/webrat/merb/session_spec.rb +++ b/spec/webrat/merb/session_spec.rb @@ -4,7 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + "/helper") describe Webrat::Session do it "should not pass empty params if data is and empty hash" do - session = Webrat::Session.new + session = Webrat::MerbSession.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::Session 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::Session.new + session = Webrat::MerbSession.new response = OpenStruct.new response.status = 200 @@ -25,7 +25,7 @@ describe Webrat::Session do context "a session with a response" do setup do - @session = Webrat::Session.new + @session = Webrat::MerbSession.new @response = OpenStruct.new @response.status = 200 @response.body = 'test response'