aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2016-10-01 11:17:43 -0400
committereileencodes <eileencodes@gmail.com>2017-02-20 15:07:33 -0500
commitf482eddbeff9fe3d0dc6cdaa9a4b53df839f667c (patch)
treed9b70ef78d4e1ee3e67430dd6e7cfc8e5a2bec4d /actionpack/test
parentb44320254167152383b1fa8792cb17847a51fb49 (diff)
downloadrails-f482eddbeff9fe3d0dc6cdaa9a4b53df839f667c.tar.gz
rails-f482eddbeff9fe3d0dc6cdaa9a4b53df839f667c.tar.bz2
rails-f482eddbeff9fe3d0dc6cdaa9a4b53df839f667c.zip
Reconfigure how the drivers work
This removes the useless Rack Test Driver that Rails was providing and moves to a shim like approach for default adapters. If someone wants to use one of the default Capybara Drivers then we will initialize a new `CapybaraDriver` that simply sets the default driver. Rails though is much more opinionated than Capybara and to make system testing a "works out of the box" framework in Rails we have the `RailsSeleniumDriver`. This driver sets defaults that Rails deems important for selenium testing. The purpose of this is to simply add a test and it just works.
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/system_testing/capybara_driver_test.rb10
-rw-r--r--actionpack/test/system_testing/capybara_rack_test_driver_test.rb26
-rw-r--r--actionpack/test/system_testing/driver_adapter_test.rb8
-rw-r--r--actionpack/test/system_testing/rails_selenium_driver_test.rb (renamed from actionpack/test/system_testing/capybara_selenium_driver_test.rb)18
4 files changed, 20 insertions, 42 deletions
diff --git a/actionpack/test/system_testing/capybara_driver_test.rb b/actionpack/test/system_testing/capybara_driver_test.rb
new file mode 100644
index 0000000000..b409fdfab0
--- /dev/null
+++ b/actionpack/test/system_testing/capybara_driver_test.rb
@@ -0,0 +1,10 @@
+require 'abstract_unit'
+
+class CapybaraDriverTest < ActiveSupport::TestCase
+ def test_setting_useragent
+ Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraDriver.new(
+ :rack_test
+ )
+ assert_equal :rack_test, Rails::SystemTestCase.driver.name
+ end
+end
diff --git a/actionpack/test/system_testing/capybara_rack_test_driver_test.rb b/actionpack/test/system_testing/capybara_rack_test_driver_test.rb
deleted file mode 100644
index 0f037760d3..0000000000
--- a/actionpack/test/system_testing/capybara_rack_test_driver_test.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-require 'abstract_unit'
-
-class CapybaraRackTestDriverTest < ActiveSupport::TestCase
- def test_default_driver_adapter
- assert_kind_of SystemTesting::DriverAdapters::CapybaraRackTestDriver, Rails::SystemTestCase.driver
- end
-
- def test_default_settings
- assert_equal 'Capybara', Rails::SystemTestCase.driver.useragent
- end
-
- def test_setting_useragent
- Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraRackTestDriver.new(
- useragent: 'x'
- )
- assert_equal 'x', Rails::SystemTestCase.driver.useragent
- end
-
- def test_does_not_accept_nonsense_kwargs
- assert_raises ArgumentError do
- Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraRackTestDriver.new(
- made_up_arg: 'x'
- )
- end
- end
-end
diff --git a/actionpack/test/system_testing/driver_adapter_test.rb b/actionpack/test/system_testing/driver_adapter_test.rb
index bfbeaa63a2..220a755bd3 100644
--- a/actionpack/test/system_testing/driver_adapter_test.rb
+++ b/actionpack/test/system_testing/driver_adapter_test.rb
@@ -7,13 +7,7 @@ class DriverAdapterTest < ActiveSupport::TestCase
end
assert_nothing_raised do
- Rails::SystemTestCase.driver = :capybara_selenium_driver
- end
- end
-
- test 'settings can only be used for the appropriate adapter' do
- assert_raises(ArgumentError) do
- Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraRackTestDriver.new(something: 'test')
+ Rails::SystemTestCase.driver = :rack_test
end
end
end
diff --git a/actionpack/test/system_testing/capybara_selenium_driver_test.rb b/actionpack/test/system_testing/rails_selenium_driver_test.rb
index 6357b35aa6..c239444838 100644
--- a/actionpack/test/system_testing/capybara_selenium_driver_test.rb
+++ b/actionpack/test/system_testing/rails_selenium_driver_test.rb
@@ -1,12 +1,12 @@
require 'abstract_unit'
-class CapybaraSeleniumDriverTest < ActiveSupport::TestCase
+class RailsSeleniumDriverTest < ActiveSupport::TestCase
def setup
- Rails::SystemTestCase.driver = :capybara_selenium_driver
+ Rails::SystemTestCase.driver = :rails_selenium_driver
end
- def test_setting_driver_adapter_to_selenium
- assert_kind_of SystemTesting::DriverAdapters::CapybaraSeleniumDriver, Rails::SystemTestCase.driver
+ def test_default_driver_adapter
+ assert_kind_of SystemTesting::DriverAdapters::RailsSeleniumDriver, Rails::SystemTestCase.driver
end
def test_default_settings
@@ -17,7 +17,7 @@ class CapybaraSeleniumDriverTest < ActiveSupport::TestCase
end
def test_setting_browser
- Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraSeleniumDriver.new(
+ Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
browser: :firefox
)
@@ -25,7 +25,7 @@ class CapybaraSeleniumDriverTest < ActiveSupport::TestCase
end
def test_setting_server
- Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraSeleniumDriver.new(
+ Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
server: :webrick
)
@@ -33,7 +33,7 @@ class CapybaraSeleniumDriverTest < ActiveSupport::TestCase
end
def test_setting_port
- Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraSeleniumDriver.new(
+ Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
port: 3000
)
@@ -41,7 +41,7 @@ class CapybaraSeleniumDriverTest < ActiveSupport::TestCase
end
def test_setting_screen_size
- Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraSeleniumDriver.new(
+ Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
screen_size: [ 800, 800 ]
)
@@ -50,7 +50,7 @@ class CapybaraSeleniumDriverTest < ActiveSupport::TestCase
def test_does_not_accept_nonsense_kwargs
assert_raises ArgumentError do
- Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraSeleniumDriver.new(
+ Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
made_up_arg: 'x'
)
end