diff options
author | eileencodes <eileencodes@gmail.com> | 2016-11-12 09:49:28 -0500 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2017-02-20 15:07:33 -0500 |
commit | 84f82f0a84de0906d195b529a9f780141c43507a (patch) | |
tree | f2919614c9ce8f0adccdfd83e47d43f6484d17bc /railties/lib/rails/generators/test_unit/system/templates | |
parent | 1db7a5c285eeb61acc998c0c27788a61bd948d5c (diff) | |
download | rails-84f82f0a84de0906d195b529a9f780141c43507a.tar.gz rails-84f82f0a84de0906d195b529a9f780141c43507a.tar.bz2 rails-84f82f0a84de0906d195b529a9f780141c43507a.zip |
Refactor config settings to use generated file
Originally I had set up system testing to have one configuration option
to be set in the test environment. After thinking it over I think a
generated class on app creation would be best. The reason for this is
Capybara has a ton of configuration options that I'm sure some folks
want to use.
Thinking about how we handle screenshots, database transactions, and a
whole bunch of other settings it would be better for users to be able to
turn all of that on and off.
When an app or scaffold is generated a `test/system_test_helper.rb` test
helper will be generated as well. This will contain the class for tests
to inherit from `ActionSystemTestCase` which will inherit from
`ActionSystemTest::Base`. Here is where users can change the test
driver, remove the screenshot helper, and add their additional Capybara
configuration.
Diffstat (limited to 'railties/lib/rails/generators/test_unit/system/templates')
-rw-r--r-- | railties/lib/rails/generators/test_unit/system/templates/system_test.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/system/templates/system_test_helper.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/test_unit/system/templates/system_test.rb b/railties/lib/rails/generators/test_unit/system/templates/system_test.rb index a74e0bb23d..bc3abd25d9 100644 --- a/railties/lib/rails/generators/test_unit/system/templates/system_test.rb +++ b/railties/lib/rails/generators/test_unit/system/templates/system_test.rb @@ -1,4 +1,4 @@ -require 'test_helper' +require "system_test_helper" class <%= class_name.pluralize %>Test < ActionSystemTestCase # test 'the truth' do diff --git a/railties/lib/rails/generators/test_unit/system/templates/system_test_helper.rb b/railties/lib/rails/generators/test_unit/system/templates/system_test_helper.rb new file mode 100644 index 0000000000..77c4738d6f --- /dev/null +++ b/railties/lib/rails/generators/test_unit/system/templates/system_test_helper.rb @@ -0,0 +1,8 @@ +require "test_helper" + +class ActionSystemTestCase < ActionSystemTest::Base + teardown do + take_failed_screenshot + Capybara.reset_sessions! + end +end |