Fix startup bug when using Webrat::Selenium with Test::Unit

This commit is contained in:
Bryan Helmkamp 2008-12-27 14:05:19 -05:00
parent 2bf3c0aaa3
commit 362df8abf0
3 changed files with 23 additions and 31 deletions

View File

@ -6,9 +6,13 @@
* Removed auto-require of webrat/rails when requiring webrat when RAILS_ENV is
defined
In your env.rb file, ensure you have:
In your env.rb or test_helper.rb file, ensure you have something like:
require "webrat/rails"
require "webrat"
Webrat.configure do |config|
config.mode = :rails
end
* Major enhancements

View File

@ -59,7 +59,7 @@ To install the latest code as a plugin: (_Note:_ This may be less stable than us
script/plugin install git://github.com/brynary/webrat.git
In your test_helper.rb, spec_helper.rb, or env.rb (for Cucumber) add:
In your test_helper.rb or env.rb (for Cucumber) add:
require "webrat"

View File

@ -38,14 +38,10 @@ module Webrat
# To use Webrat's Selenium support, you'll need the selenium-client gem installed.
# Activate it with (for example, in your <tt>env.rb</tt>):
#
# require "webrat/selenium"
#
# Then, if you're using Cucumber, configure it to use a
# <tt>Webrat::Selenium::Rails::World</tt> as the scenario context by adding
# the following to <tt>env.rb</tt>:
#
# World do
# Webrat::Selenium::Rails::World.new
# require "webrat"
#
# Webrat.configure do |config|
# config.mode = :selenium
# end
#
# == Dropping down to the selenium-client API
@ -72,34 +68,26 @@ module Webrat
# your Webrat::Selenium tests ignoring the concurrency issues that can plague in-browser
# testing, so long as you're using the Webrat API.
module Selenium
module Rails #:nodoc:
class World < ::ActionController::IntegrationTest
include Webrat::Selenium::Matchers
def initialize #:nodoc:
@_result = Test::Unit::TestResult.new
end
def response
webrat_session.response
end
def wait_for(*args, &block)
webrat_session.wait_for(*args, &block)
end
module Methods
def response
webrat_session.response
end
def save_and_open_screengrab
webrat_session.save_and_open_screengrab
end
def wait_for(*args, &block)
webrat_session.wait_for(*args, &block)
end
def save_and_open_screengrab
webrat_session.save_and_open_screengrab
end
end
end
end
module ActionController #:nodoc:
IntegrationTest.class_eval do
include Webrat::Methods
include Webrat::Selenium::Methods
include Webrat::Selenium::Matchers
end
end