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 * Removed auto-require of webrat/rails when requiring webrat when RAILS_ENV is
defined 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 * 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 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" require "webrat"

View File

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