From 055bd568f5bcf7141e82a56ad41ae9b074b9d779 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Fri, 7 Nov 2008 17:04:01 -0500 Subject: [PATCH] Use @_webrat_session instance variable instead of @session for Merb integration to avoid collisions --- History.txt | 6 ++++++ lib/webrat.rb | 2 +- lib/webrat/core/methods.rb | 4 ++-- lib/webrat/merb.rb | 6 +++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/History.txt b/History.txt index 45a0c00..abd0d4e 100644 --- a/History.txt +++ b/History.txt @@ -1,3 +1,9 @@ +== Trunk + + * Minor enhancements + + * Use @_webrat_session instance variable instead of @session for Merb integration to avoid collisions + == 0.3.0 / 2008-11-07 * Major enhancements diff --git a/lib/webrat.rb b/lib/webrat.rb index 94bc04b..84a51d1 100644 --- a/lib/webrat.rb +++ b/lib/webrat.rb @@ -3,7 +3,7 @@ require "rubygems" $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__))) module Webrat - VERSION = '0.3.0' + VERSION = '0.3.1' def self.root #:nodoc: defined?(RAILS_ROOT) ? RAILS_ROOT : Merb.root diff --git a/lib/webrat/core/methods.rb b/lib/webrat/core/methods.rb index ad9e0db..e1286f6 100644 --- a/lib/webrat/core/methods.rb +++ b/lib/webrat/core/methods.rb @@ -5,8 +5,8 @@ module Webrat meths.each do |meth| self.class_eval <<-RUBY def #{meth}(*args, &blk) - @session ||= ::Webrat::MerbSession.new - @session.#{meth}(*args, &blk) + @_webrat_session ||= ::Webrat::MerbSession.new + @_webrat_session.#{meth}(*args, &blk) end RUBY end diff --git a/lib/webrat/merb.rb b/lib/webrat/merb.rb index 6842cc5..e81b014 100644 --- a/lib/webrat/merb.rb +++ b/lib/webrat/merb.rb @@ -56,12 +56,12 @@ module Merb module Test module RequestHelper #:nodoc: def request(uri, env = {}) - @session ||= Webrat::MerbSession.new - @session.response = @session.request(uri, env) + @_webrat_session ||= Webrat::MerbSession.new + @_webrat_session.response = @_webrat_session.request(uri, env) end def follow_redirect - @session.follow_redirect + @_webrat_session.follow_redirect end end end