Use @_webrat_session instance variable instead of @session for Merb integration to avoid collisions

This commit is contained in:
Bryan Helmkamp 2008-11-07 17:04:01 -05:00
parent 1fb04374a7
commit 055bd568f5
4 changed files with 12 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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