diff options
Diffstat (limited to 'actionsystemtest/lib/action_system_test.rb')
-rw-r--r-- | actionsystemtest/lib/action_system_test.rb | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/actionsystemtest/lib/action_system_test.rb b/actionsystemtest/lib/action_system_test.rb index 18b992a3ca..f9fb8b4e5c 100644 --- a/actionsystemtest/lib/action_system_test.rb +++ b/actionsystemtest/lib/action_system_test.rb @@ -1,20 +1,16 @@ -require "action_system_test/test_helper" -require "action_system_test/driver_adapter" - # System tests are similar to Integration tests in that they incorporate multiple # controllers and actions, but can be used to simulate a real user experience. # System tests are also known as Acceptance tests. # -# To create a System Test in your application extend your test class from +# To create a System Test in your application, extend your test class from # <tt>ActionSystemTestCase</tt>. System tests use Capybara as a base and -# allows you to configure the driver. The default driver is -# <tt>RailsSeleniumDriver</tt> which provides Capybara with no-setup -# configuration of the Selenium Driver. If you prefer you can use the bare -# Selenium driver and set your own configuration. +# allow you to configure the driver. The default driver is +# <tt>RailsSeleniumDriver</tt> which provides a Capybara and the Selenium +# Driver with no configuration. It's intended to work out of the box. # # A system test looks like the following: # -# require 'test_helper' +# require 'system_test_helper' # # class Users::CreateTest < ActionSystemTestCase # def adding_a_new_user @@ -28,17 +24,23 @@ require "action_system_test/driver_adapter" # end # end # -# System test driver can be configured in your Rails configuration file for the -# test environment. +# When generating an application or scaffold a +system_test_helper.rb+ will also +# be generated containing the base class for system testing. This is where you can +# change the driver, add Capybara settings, and other configuration for your system +# tests. # -# config.system_testing.driver = :rails_selenium_driver +# class ActionSystemTestCase < ActionSystemTest::Base +# ActionSystemTest.driver = :rack_test +# end # # You can also specify a driver by initializing a new driver object. This allows # you to change the default settings for the driver you're setting. # -# config.system_testing.driver = ActionSystemTest::DriverAdapters::RailsSeleniumDriver.new( -# browser: :firefox -# ) +# class ActionSystemTestCase < ActionSystemTest::Base +# ActionSystemTest.driver = ActionSystemTest::DriverAdapters::RailsSeleniumDriver.new( +# browser: :firefox +# ) +# end # # A list of supported adapters can be found in DriverAdapters. # @@ -47,11 +49,19 @@ require "action_system_test/driver_adapter" # +:selenium+, +:webkit+, or +:poltergeist+. These 4 drivers use Capyara's # driver defaults whereas the <tt>RailsSeleniumDriver</tt> has pre-set # configuration for browser, server, port, etc. + +require "action_system_test/test_helper" +require "action_system_test/driver_adapter" + module ActionSystemTest include ActionSystemTest::TestHelper include ActionSystemTest::DriverAdapter -end -class ActionSystemTestCase < ActionDispatch::IntegrationTest - include ActionSystemTest + DEFAULT_DRIVER = :rails_selenium_driver + + class Base < ActionDispatch::IntegrationTest + include ActionSystemTest + + ActionSystemTest.driver = DEFAULT_DRIVER + end end |