diff --git a/History.txt b/History.txt index 7775b14..98ad3c1 100644 --- a/History.txt +++ b/History.txt @@ -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 diff --git a/README.rdoc b/README.rdoc index 708322d..f08a62d 100644 --- a/README.rdoc +++ b/README.rdoc @@ -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" diff --git a/lib/webrat/selenium.rb b/lib/webrat/selenium.rb index 6de2a7c..3e8b999 100644 --- a/lib/webrat/selenium.rb +++ b/lib/webrat/selenium.rb @@ -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 env.rb): # - # require "webrat/selenium" - # - # Then, if you're using Cucumber, configure it to use a - # Webrat::Selenium::Rails::World as the scenario context by adding - # the following to env.rb: - # - # 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