Turn system testing into it's own gem and rename
Renames `Rails::SystemTestCase` to `ActionSystemTest` and moves it to a gem under the Rails name. We need to name the class `ActionSystemTestCase` because the gem expects a module but tests themselves expect a class. Adds MIT-LICENSE, CHANGELOG, and README for the future.
This commit is contained in:
parent
a21e18d508
commit
5bf0aa6745
|
@ -36,7 +36,7 @@ env:
|
||||||
matrix:
|
matrix:
|
||||||
- "GEM=railties"
|
- "GEM=railties"
|
||||||
- "GEM=ap,ac"
|
- "GEM=ap,ac"
|
||||||
- "GEM=am,amo,as,av,aj"
|
- "GEM=am,amo,as,av,aj,ast"
|
||||||
- "GEM=as PRESERVE_TIMEZONES=1"
|
- "GEM=as PRESERVE_TIMEZONES=1"
|
||||||
- "GEM=ar:mysql2"
|
- "GEM=ar:mysql2"
|
||||||
- "GEM=ar:sqlite3"
|
- "GEM=ar:sqlite3"
|
||||||
|
|
|
@ -45,11 +45,14 @@ PATH
|
||||||
actionpack (5.1.0.alpha)
|
actionpack (5.1.0.alpha)
|
||||||
actionview (= 5.1.0.alpha)
|
actionview (= 5.1.0.alpha)
|
||||||
activesupport (= 5.1.0.alpha)
|
activesupport (= 5.1.0.alpha)
|
||||||
capybara (~> 2.7.0)
|
|
||||||
rack (~> 2.0)
|
rack (~> 2.0)
|
||||||
rack-test (~> 0.6.3)
|
rack-test (~> 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||||
|
actionsystemtest (5.1.0.alpha)
|
||||||
|
actionpack (= 5.1.0.alpha)
|
||||||
|
activesupport (= 5.1.0.alpha)
|
||||||
|
capybara (~> 2.7.0)
|
||||||
actionview (5.1.0.alpha)
|
actionview (5.1.0.alpha)
|
||||||
activesupport (= 5.1.0.alpha)
|
activesupport (= 5.1.0.alpha)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
|
@ -84,6 +87,7 @@ PATH
|
||||||
sprockets-rails (>= 2.0.0)
|
sprockets-rails (>= 2.0.0)
|
||||||
railties (5.1.0.alpha)
|
railties (5.1.0.alpha)
|
||||||
actionpack (= 5.1.0.alpha)
|
actionpack (= 5.1.0.alpha)
|
||||||
|
actionsystemtest (= 5.1.0.alpha)
|
||||||
activesupport (= 5.1.0.alpha)
|
activesupport (= 5.1.0.alpha)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
|
@ -126,7 +130,7 @@ GEM
|
||||||
bunny (2.6.2)
|
bunny (2.6.2)
|
||||||
amq-protocol (>= 2.0.1)
|
amq-protocol (>= 2.0.1)
|
||||||
byebug (9.0.6)
|
byebug (9.0.6)
|
||||||
capybara (2.7.0)
|
capybara (2.7.1)
|
||||||
addressable
|
addressable
|
||||||
mime-types (>= 1.16)
|
mime-types (>= 1.16)
|
||||||
nokogiri (>= 1.3.3)
|
nokogiri (>= 1.3.3)
|
||||||
|
|
|
@ -26,7 +26,6 @@ Gem::Specification.new do |s|
|
||||||
s.add_dependency "rails-html-sanitizer", "~> 1.0", ">= 1.0.2"
|
s.add_dependency "rails-html-sanitizer", "~> 1.0", ">= 1.0.2"
|
||||||
s.add_dependency "rails-dom-testing", "~> 2.0"
|
s.add_dependency "rails-dom-testing", "~> 2.0"
|
||||||
s.add_dependency "actionview", version
|
s.add_dependency "actionview", version
|
||||||
s.add_dependency "capybara", "~> 2.7.0"
|
|
||||||
|
|
||||||
s.add_development_dependency "activemodel", version
|
s.add_development_dependency "activemodel", version
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
require "system_testing/test_helper"
|
|
||||||
require "system_testing/driver_adapter"
|
|
||||||
|
|
||||||
module Rails
|
|
||||||
# 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
|
|
||||||
# <tt>Rails::SystemTestCase</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.
|
|
||||||
#
|
|
||||||
# A system test looks like the following:
|
|
||||||
#
|
|
||||||
# require 'test_helper'
|
|
||||||
#
|
|
||||||
# class Users::CreateTest < Rails::SystemTestCase
|
|
||||||
# def adding_a_new_user
|
|
||||||
# visit users_path
|
|
||||||
# click_on 'New User'
|
|
||||||
#
|
|
||||||
# fill_in 'Name', with: 'Arya'
|
|
||||||
# click_on 'Create User'
|
|
||||||
#
|
|
||||||
# assert_text 'Arya'
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# System test driver can be configured in your Rails configuration file for the
|
|
||||||
# test environment.
|
|
||||||
#
|
|
||||||
# config.system_testing.driver = :rails_selenium_driver
|
|
||||||
#
|
|
||||||
# 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 = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
|
|
||||||
# browser: :firefox
|
|
||||||
# )
|
|
||||||
#
|
|
||||||
# A list of supported adapters can be found in DriverAdapters.
|
|
||||||
#
|
|
||||||
# If you want to use one of the default drivers provided by Capybara you can
|
|
||||||
# set the driver in your config to one of those defaults: +:rack_test+,
|
|
||||||
# +: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.
|
|
||||||
class SystemTestCase < ActionDispatch::IntegrationTest
|
|
||||||
include SystemTesting::TestHelper
|
|
||||||
include SystemTesting::DriverAdapter
|
|
||||||
|
|
||||||
ActiveSupport.run_load_hooks(:system_testing, self)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -33,7 +33,6 @@ require "action_view/testing/resolvers"
|
||||||
require "action_dispatch"
|
require "action_dispatch"
|
||||||
require "active_support/dependencies"
|
require "active_support/dependencies"
|
||||||
require "active_model"
|
require "active_model"
|
||||||
require "system_test_case"
|
|
||||||
|
|
||||||
require "pp" # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late
|
require "pp" # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late
|
||||||
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
require "abstract_unit"
|
|
||||||
|
|
||||||
class CapybaraDriverTest < ActiveSupport::TestCase
|
|
||||||
def setup
|
|
||||||
Rails::SystemTestCase.driver = :poltergeist
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_default_driver_adapter
|
|
||||||
assert_kind_of SystemTesting::DriverAdapters::CapybaraDriver, Rails::SystemTestCase.driver
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_default_settings
|
|
||||||
assert_equal :poltergeist, Rails::SystemTestCase.driver.name
|
|
||||||
assert_equal :puma, Rails::SystemTestCase.driver.server
|
|
||||||
assert_equal 28100, Rails::SystemTestCase.driver.port
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_setting_driver
|
|
||||||
Rails::SystemTestCase.driver = :webkit
|
|
||||||
|
|
||||||
assert_equal :webkit, Rails::SystemTestCase.driver.name
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_setting_server
|
|
||||||
Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraDriver.new(
|
|
||||||
server: :webrick
|
|
||||||
)
|
|
||||||
|
|
||||||
assert_equal :webrick, Rails::SystemTestCase.driver.server
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_setting_port
|
|
||||||
Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraDriver.new(
|
|
||||||
port: 3000
|
|
||||||
)
|
|
||||||
|
|
||||||
assert_equal 3000, Rails::SystemTestCase.driver.port
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,58 +0,0 @@
|
||||||
require "abstract_unit"
|
|
||||||
|
|
||||||
class RailsSeleniumDriverTest < ActiveSupport::TestCase
|
|
||||||
def setup
|
|
||||||
Rails::SystemTestCase.driver = :rails_selenium_driver
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_default_driver_adapter
|
|
||||||
assert_kind_of SystemTesting::DriverAdapters::RailsSeleniumDriver, Rails::SystemTestCase.driver
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_default_settings
|
|
||||||
assert_equal :chrome, Rails::SystemTestCase.driver.browser
|
|
||||||
assert_equal :puma, Rails::SystemTestCase.driver.server
|
|
||||||
assert_equal 28100, Rails::SystemTestCase.driver.port
|
|
||||||
assert_equal [1400,1400], Rails::SystemTestCase.driver.screen_size
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_setting_browser
|
|
||||||
Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
|
|
||||||
browser: :firefox
|
|
||||||
)
|
|
||||||
|
|
||||||
assert_equal :firefox, Rails::SystemTestCase.driver.browser
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_setting_server
|
|
||||||
Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
|
|
||||||
server: :webrick
|
|
||||||
)
|
|
||||||
|
|
||||||
assert_equal :webrick, Rails::SystemTestCase.driver.server
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_setting_port
|
|
||||||
Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
|
|
||||||
port: 3000
|
|
||||||
)
|
|
||||||
|
|
||||||
assert_equal 3000, Rails::SystemTestCase.driver.port
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_setting_screen_size
|
|
||||||
Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
|
|
||||||
screen_size: [ 800, 800 ]
|
|
||||||
)
|
|
||||||
|
|
||||||
assert_equal [ 800, 800 ], Rails::SystemTestCase.driver.screen_size
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_does_not_accept_nonsense_kwargs
|
|
||||||
assert_raises ArgumentError do
|
|
||||||
Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
|
|
||||||
made_up_arg: "x"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,20 +0,0 @@
|
||||||
require "abstract_unit"
|
|
||||||
|
|
||||||
class ScreenshotHelperTest < ActiveSupport::TestCase
|
|
||||||
def test_driver_support_for_screenshots
|
|
||||||
Rails::SystemTestCase.driver = :rails_selenium_driver
|
|
||||||
assert Rails::SystemTestCase.driver.supports_screenshots?
|
|
||||||
|
|
||||||
Rails::SystemTestCase.driver = :rack_test
|
|
||||||
assert_not Rails::SystemTestCase.driver.supports_screenshots?
|
|
||||||
|
|
||||||
Rails::SystemTestCase.driver = :selenium
|
|
||||||
assert Rails::SystemTestCase.driver.supports_screenshots?
|
|
||||||
|
|
||||||
Rails::SystemTestCase.driver = :webkit
|
|
||||||
assert Rails::SystemTestCase.driver.supports_screenshots?
|
|
||||||
|
|
||||||
Rails::SystemTestCase.driver = :poltergeist
|
|
||||||
assert Rails::SystemTestCase.driver.supports_screenshots?
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
* Added to Rails!
|
||||||
|
|
||||||
|
*Eileen M. Uchitelle*
|
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright (c) 2017 David Heinemeier Hansson
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,108 @@
|
||||||
|
# Action System Test
|
||||||
|
|
||||||
|
Action System Test adds Capybara integration to your Rails application for
|
||||||
|
acceptance testing. This allows you to test the entire user experience
|
||||||
|
of your application rather than just your controllers, or just your models.
|
||||||
|
|
||||||
|
Action System Test provides all of the setup out of the box for you to use
|
||||||
|
Capybara with the Selenium Driver in your Rails application. Changing the
|
||||||
|
default configuration is simple, yet flexible.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
By default Rails provides applications with system testing through Capybara
|
||||||
|
and defaults to using the Selenium driver. The configuration set by Rails
|
||||||
|
means that when you generate an application system tests will work out of
|
||||||
|
the box, without you having to change any of the configuration requirements.
|
||||||
|
|
||||||
|
Action System Test uses all the helpers from Capybara, but abstracts away the
|
||||||
|
setup required to get running. Below is an example Action System Test.
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
class UsersTest < ActionSystemTestCase
|
||||||
|
setup do
|
||||||
|
visit users_path
|
||||||
|
end
|
||||||
|
|
||||||
|
test 'creating a new user' do
|
||||||
|
click_on 'New User'
|
||||||
|
|
||||||
|
fill_in 'Name', with: 'Arya'
|
||||||
|
|
||||||
|
click_on 'Create User'
|
||||||
|
|
||||||
|
assert_text 'Arya'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
First we visit the +users_path+. From there we are going to use Action System
|
||||||
|
Test to create a new user. The test will click on the "New User" button. Then
|
||||||
|
it will fill in the "Name" field with "Arya" and click on the "Create User"
|
||||||
|
button. Lastly, we assert that the text on the Users show page is what we
|
||||||
|
expected, which in this case is "Arya".
|
||||||
|
|
||||||
|
For more helpers and how to write Capybara tests visit Capybara's README.
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
When generating a new application Rails will include the Capybara gem, the
|
||||||
|
Selenium gem, and a <tt>system_test_helper.rb</tt> file. The
|
||||||
|
<tt>system_test_helper.rb</tt> file is where you can change the desired
|
||||||
|
configuration if Rails doesn't work out of the box for you.
|
||||||
|
|
||||||
|
The <tt>system_test_helper.rb</tt> file provides a home for all of your Capybara
|
||||||
|
and Action System Test configuration.
|
||||||
|
|
||||||
|
Rails preset configuration for Capybara with Selenium defaults to Puma for
|
||||||
|
the web server on port 28100, Chrome for the browser, and a screen size of
|
||||||
|
1400 x 1400.
|
||||||
|
|
||||||
|
Changing the configuration is as simple as changing the driver in your
|
||||||
|
<tt>system_test_helper.rb</tt>
|
||||||
|
|
||||||
|
If you want to change the default settings of the Rails provided Selenium
|
||||||
|
configuration options you can initialize a new <tt>RailsSeleniumDriver</tt>
|
||||||
|
object.
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
class ActionSystemTestCase < ActionSystemTest::Base
|
||||||
|
ActionSystemTest.driver = RailsSeleniumDriver.new(
|
||||||
|
browser: :firefox,
|
||||||
|
server: :webrick
|
||||||
|
)
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
Capybara itself provides 4 drivers: RackTest, Selenium, Webkit, and Poltergeist.
|
||||||
|
Action System Test provides a shim between Rails and Capybara for these 4 drivers.
|
||||||
|
Please note, that Rails is set up to use the Puma server by default for these
|
||||||
|
4 drivers. Puma is the default in Rails and therefore is set as the default in
|
||||||
|
the Rails Capybara integration.
|
||||||
|
|
||||||
|
To set your application tests to use any of Capybara's defaults with no configuration,
|
||||||
|
set the following in your <tt>system_test_helper.rb</tt> file and follow setup instructions
|
||||||
|
for environment requirements of these drivers.
|
||||||
|
|
||||||
|
The possible settings are +:rack_test+, +:selenium+, +:webkit+, or +:poltergeist+.
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
class ActionSystemTestCase < ActionSystemTest::Base
|
||||||
|
ActionSystemTest.driver = :poltergeist
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to change the default server (puma) or port (28100) for Capbyara drivers
|
||||||
|
you can initialize a new object.
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
class ActionSystemTestCase < ActionSystemTest::Base
|
||||||
|
ActionSystemTest.driver = ActionSystemTest::DriverAdapters::CapybaraDriver.new(
|
||||||
|
name: :poltergeist,
|
||||||
|
server: :webkit,
|
||||||
|
port: 3000
|
||||||
|
)
|
||||||
|
end
|
||||||
|
```
|
|
@ -0,0 +1,32 @@
|
||||||
|
require "rake/testtask"
|
||||||
|
|
||||||
|
test_files = Dir.glob("test/**/*_test.rb")
|
||||||
|
|
||||||
|
desc "Default Task"
|
||||||
|
task default: :test
|
||||||
|
|
||||||
|
task :package
|
||||||
|
|
||||||
|
# Run the unit tests
|
||||||
|
Rake::TestTask.new do |t|
|
||||||
|
t.libs << "test"
|
||||||
|
t.test_files = test_files
|
||||||
|
|
||||||
|
t.warning = true
|
||||||
|
t.verbose = true
|
||||||
|
t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION)
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace :test do
|
||||||
|
task :isolated do
|
||||||
|
test_files.all? do |file|
|
||||||
|
sh(Gem.ruby, "-w", "-Ilib:test", file)
|
||||||
|
end || raise("Failures")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
task :lines do
|
||||||
|
load File.expand_path("..", File.dirname(__FILE__)) + "/tools/line_statistics"
|
||||||
|
files = FileList["lib/**/*.rb"]
|
||||||
|
CodeTools::LineStatistics.new(files).print_loc
|
||||||
|
end
|
|
@ -0,0 +1,24 @@
|
||||||
|
version = File.read(File.expand_path("../../RAILS_VERSION", __FILE__)).strip
|
||||||
|
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.platform = Gem::Platform::RUBY
|
||||||
|
s.name = "actionsystemtest"
|
||||||
|
s.version = version
|
||||||
|
s.summary = "Acceptance test framework for Rails."
|
||||||
|
s.description = "Test framework for testing web applications by simulating how users interact with your application."
|
||||||
|
|
||||||
|
s.required_ruby_version = ">= 2.2.2"
|
||||||
|
|
||||||
|
s.license = "MIT"
|
||||||
|
|
||||||
|
s.author = ["Eileen Uchitelle", "David Heinemeier Hansson"]
|
||||||
|
s.email = ["eileencodes@gmail.com", "david@loudthinking.com"]
|
||||||
|
s.homepage = "http://rubyonrails.org"
|
||||||
|
|
||||||
|
s.files = Dir["CHANGELOG.md", "MIT-LICENSE", "README.md", "lib/**/*"]
|
||||||
|
s.require_path = "lib"
|
||||||
|
|
||||||
|
s.add_dependency "capybara", "~> 2.7.0"
|
||||||
|
s.add_dependency "actionpack", version
|
||||||
|
s.add_dependency "activesupport", version
|
||||||
|
end
|
|
@ -0,0 +1,59 @@
|
||||||
|
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
|
||||||
|
# <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.
|
||||||
|
#
|
||||||
|
# A system test looks like the following:
|
||||||
|
#
|
||||||
|
# require 'test_helper'
|
||||||
|
#
|
||||||
|
# class Users::CreateTest < ActionSystemTestCase
|
||||||
|
# def adding_a_new_user
|
||||||
|
# visit users_path
|
||||||
|
# click_on 'New User'
|
||||||
|
#
|
||||||
|
# fill_in 'Name', with: 'Arya'
|
||||||
|
# click_on 'Create User'
|
||||||
|
#
|
||||||
|
# assert_text 'Arya'
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# System test driver can be configured in your Rails configuration file for the
|
||||||
|
# test environment.
|
||||||
|
#
|
||||||
|
# config.system_testing.driver = :rails_selenium_driver
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
# )
|
||||||
|
#
|
||||||
|
# A list of supported adapters can be found in DriverAdapters.
|
||||||
|
#
|
||||||
|
# If you want to use one of the default drivers provided by Capybara you can
|
||||||
|
# set the driver in your config to one of those defaults: +:rack_test+,
|
||||||
|
# +: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.
|
||||||
|
module ActionSystemTest
|
||||||
|
include ActionSystemTest::TestHelper
|
||||||
|
include ActionSystemTest::DriverAdapter
|
||||||
|
|
||||||
|
ActiveSupport.run_load_hooks(:system_testing, self)
|
||||||
|
end
|
||||||
|
|
||||||
|
class ActionSystemTestCase < ActionDispatch::IntegrationTest
|
||||||
|
include ActionSystemTest
|
||||||
|
end
|
|
@ -1,7 +1,7 @@
|
||||||
require "system_testing/driver_adapters"
|
require "action_system_test/driver_adapters"
|
||||||
|
|
||||||
module SystemTesting
|
module ActionSystemTest
|
||||||
# The <tt>SystemTesting::DriverAdapter</tt> module is used to load the driver
|
# The <tt>ActionSystemTest::DriverAdapter</tt> module is used to load the driver
|
||||||
# set in your Rails' test configuration file.
|
# set in your Rails' test configuration file.
|
||||||
#
|
#
|
||||||
# The default driver adapter is the +:rails_selenium_driver+.
|
# The default driver adapter is the +:rails_selenium_driver+.
|
|
@ -1,4 +1,4 @@
|
||||||
module SystemTesting
|
module ActionSystemTest
|
||||||
# == System Testing Driver Adapters
|
# == System Testing Driver Adapters
|
||||||
#
|
#
|
||||||
# By default Rails supports Capybara with the Selenium Driver. Rails provides
|
# By default Rails supports Capybara with the Selenium Driver. Rails provides
|
||||||
|
@ -29,8 +29,8 @@ module SystemTesting
|
||||||
class << self
|
class << self
|
||||||
# Returns driver for specified name.
|
# Returns driver for specified name.
|
||||||
#
|
#
|
||||||
# SystemTesting::DriverAdapters.lookup(:rails_selenium_driver)
|
# ActionSystemTest::DriverAdapters.lookup(:rails_selenium_driver)
|
||||||
# # => SystemTesting::DriverAdapters::RailsSeleniumDriver
|
# # => ActionSystemTest::DriverAdapters::RailsSeleniumDriver
|
||||||
def lookup(driver)
|
def lookup(driver)
|
||||||
if CapybaraDriver::CAPYBARA_DEFAULTS.include?(driver)
|
if CapybaraDriver::CAPYBARA_DEFAULTS.include?(driver)
|
||||||
CapybaraDriver.new(name: driver)
|
CapybaraDriver.new(name: driver)
|
|
@ -1,6 +1,6 @@
|
||||||
require "system_testing/driver_adapters/web_server"
|
require "action_system_test/driver_adapters/web_server"
|
||||||
|
|
||||||
module SystemTesting
|
module ActionSystemTest
|
||||||
module DriverAdapters
|
module DriverAdapters
|
||||||
# == CapybaraDriver for System Testing
|
# == CapybaraDriver for System Testing
|
||||||
#
|
#
|
||||||
|
@ -29,7 +29,7 @@ module SystemTesting
|
||||||
#
|
#
|
||||||
# The default settings for the <tt>CapybaraDriver</tt> are:
|
# The default settings for the <tt>CapybaraDriver</tt> are:
|
||||||
#
|
#
|
||||||
# #<SystemTesting::DriverAdapters::CapybaraDriver:0x007ff0e992c1d8
|
# #<ActionSystemTest::DriverAdapters::CapybaraDriver:0x007ff0e992c1d8
|
||||||
# @name=:rack_test,
|
# @name=:rack_test,
|
||||||
# @server=:puma,
|
# @server=:puma,
|
||||||
# @port=28100
|
# @port=28100
|
||||||
|
@ -38,7 +38,7 @@ module SystemTesting
|
||||||
# The settings for the <tt>CapybaraDriver</tt> can be changed from
|
# The settings for the <tt>CapybaraDriver</tt> can be changed from
|
||||||
# Rails' configuration file.
|
# Rails' configuration file.
|
||||||
#
|
#
|
||||||
# config.system_testing.driver = SystemTesting::DriverAdapters::CapybaraDriver.new(
|
# config.system_testing.driver = ActionSystemTest::DriverAdapters::CapybaraDriver.new(
|
||||||
# name: :webkit,
|
# name: :webkit,
|
||||||
# server: :webrick
|
# server: :webrick
|
||||||
# )
|
# )
|
|
@ -1,6 +1,6 @@
|
||||||
require "system_testing/driver_adapters/web_server"
|
require "action_system_test/driver_adapters/web_server"
|
||||||
|
|
||||||
module SystemTesting
|
module ActionSystemTest
|
||||||
module DriverAdapters
|
module DriverAdapters
|
||||||
# == RailsSeleniumDriver for System Testing
|
# == RailsSeleniumDriver for System Testing
|
||||||
#
|
#
|
||||||
|
@ -23,7 +23,7 @@ module SystemTesting
|
||||||
# by default. The default settings for the <tt>RailsSeleniumDriver</tt>
|
# by default. The default settings for the <tt>RailsSeleniumDriver</tt>
|
||||||
# are as follows:
|
# are as follows:
|
||||||
#
|
#
|
||||||
# #<SystemTesting::DriverAdapters::RailsSeleniumDriver:0x007ff0e992c1d8
|
# #<ActionSystemTest::DriverAdapters::RailsSeleniumDriver:0x007ff0e992c1d8
|
||||||
# @browser=:chrome,
|
# @browser=:chrome,
|
||||||
# @server=:puma,
|
# @server=:puma,
|
||||||
# @port=28100,
|
# @port=28100,
|
||||||
|
@ -33,7 +33,7 @@ module SystemTesting
|
||||||
# The settings for the <tt>RailsSeleniumDriver</tt> can be changed in the
|
# The settings for the <tt>RailsSeleniumDriver</tt> can be changed in the
|
||||||
# Rails configuration file.
|
# Rails configuration file.
|
||||||
#
|
#
|
||||||
# config.system_testing.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
|
# config.system_testing.driver = ActionSystemTest::DriverAdapters::RailsSeleniumDriver.new(
|
||||||
# server: :webrick,
|
# server: :webrick,
|
||||||
# port: 28100,
|
# port: 28100,
|
||||||
# screen_size: [ 800, 800 ]
|
# screen_size: [ 800, 800 ]
|
||||||
|
@ -46,7 +46,7 @@ module SystemTesting
|
||||||
# +:chrome+ to +:firefox+, initialize the Selenium driver in your Rails'
|
# +:chrome+ to +:firefox+, initialize the Selenium driver in your Rails'
|
||||||
# test environment:
|
# test environment:
|
||||||
#
|
#
|
||||||
# config.system_testing.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
|
# config.system_testing.driver = ActionSystemTest::DriverAdapters::RailsSeleniumDriver.new(
|
||||||
# browser: :firefox
|
# browser: :firefox
|
||||||
# )
|
# )
|
||||||
class RailsSeleniumDriver
|
class RailsSeleniumDriver
|
|
@ -4,7 +4,7 @@ rescue LoadError
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
module SystemTesting
|
module ActionSystemTest
|
||||||
module DriverAdapters
|
module DriverAdapters
|
||||||
module WebServer # :nodoc:
|
module WebServer # :nodoc:
|
||||||
def register_server
|
def register_server
|
||||||
|
@ -13,7 +13,7 @@ module SystemTesting
|
||||||
when :puma
|
when :puma
|
||||||
register_puma(app, port)
|
register_puma(app, port)
|
||||||
when :webrick
|
when :webrick
|
||||||
register_webrick(app, port, host)
|
register_webrick(app, port)
|
||||||
else
|
else
|
||||||
register_default(app, port)
|
register_default(app, port)
|
||||||
end
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
module ActionSystemTest
|
||||||
|
# Returns the version of the currently loaded Action System Test as a <tt>Gem::Version</tt>.
|
||||||
|
def self.gem_version
|
||||||
|
Gem::Version.new VERSION::STRING
|
||||||
|
end
|
||||||
|
|
||||||
|
module VERSION
|
||||||
|
MAJOR = 5
|
||||||
|
MINOR = 1
|
||||||
|
TINY = 0
|
||||||
|
PRE = "alpha"
|
||||||
|
|
||||||
|
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,13 +1,13 @@
|
||||||
require "system_test_case"
|
require "action_system_test"
|
||||||
|
|
||||||
module SystemTesting
|
module ActionSystemTest
|
||||||
# = System Testing Railtie
|
# = System Testing Railtie
|
||||||
class Railtie < Rails::Railtie # :nodoc:
|
class Railtie < Rails::Railtie # :nodoc:
|
||||||
config.system_testing = ActiveSupport::OrderedOptions.new
|
config.system_testing = ActiveSupport::OrderedOptions.new
|
||||||
|
|
||||||
initializer "system_testing.set_configs" do |app|
|
initializer "system_testing.set_configs" do |app|
|
||||||
options = app.config.system_testing
|
options = app.config.system_testing
|
||||||
options.driver ||= Rails::SystemTestCase.default_driver
|
options.driver ||= ActionSystemTest.default_driver
|
||||||
|
|
||||||
ActiveSupport.on_load(:system_testing) do
|
ActiveSupport.on_load(:system_testing) do
|
||||||
options.each { |k,v| send("#{k}=", v) }
|
options.each { |k,v| send("#{k}=", v) }
|
|
@ -1,7 +1,7 @@
|
||||||
require "capybara/dsl"
|
require "capybara/dsl"
|
||||||
require "system_testing/test_helpers"
|
require "action_system_test/test_helpers"
|
||||||
|
|
||||||
module SystemTesting
|
module ActionSystemTest
|
||||||
module TestHelper # :nodoc:
|
module TestHelper # :nodoc:
|
||||||
include TestHelpers::Assertions
|
include TestHelpers::Assertions
|
||||||
include TestHelpers::FormHelper
|
include TestHelpers::FormHelper
|
|
@ -1,4 +1,4 @@
|
||||||
module SystemTesting
|
module ActionSystemTest
|
||||||
module TestHelpers
|
module TestHelpers
|
||||||
extend ActiveSupport::Autoload
|
extend ActiveSupport::Autoload
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module SystemTesting
|
module ActionSystemTest
|
||||||
module TestHelpers
|
module TestHelpers
|
||||||
# Assertions for system testing that aren't included by default in Capybara.
|
# Assertions for system testing that aren't included by default in Capybara.
|
||||||
# These are assertions that are useful specifically for Rails applications.
|
# These are assertions that are useful specifically for Rails applications.
|
|
@ -1,4 +1,4 @@
|
||||||
module SystemTesting
|
module ActionSystemTest
|
||||||
module TestHelpers
|
module TestHelpers
|
||||||
# Form helpers for system testing that aren't included by default in
|
# Form helpers for system testing that aren't included by default in
|
||||||
# Capybara.
|
# Capybara.
|
|
@ -1,4 +1,4 @@
|
||||||
module SystemTesting
|
module ActionSystemTest
|
||||||
module TestHelpers
|
module TestHelpers
|
||||||
# Screenshot helper for system testing
|
# Screenshot helper for system testing
|
||||||
module ScreenshotHelper
|
module ScreenshotHelper
|
||||||
|
@ -11,7 +11,7 @@ module SystemTesting
|
||||||
#
|
#
|
||||||
# You can check of the driver supports screenshots by running
|
# You can check of the driver supports screenshots by running
|
||||||
#
|
#
|
||||||
# Rails::SystemTestCase.driver.supports_screenshots?
|
# ActionSystemTest.driver.supports_screenshots?
|
||||||
# => true
|
# => true
|
||||||
def take_screenshot
|
def take_screenshot
|
||||||
puts "[Screenshot]: #{image_path}"
|
puts "[Screenshot]: #{image_path}"
|
||||||
|
@ -20,7 +20,7 @@ module SystemTesting
|
||||||
|
|
||||||
private
|
private
|
||||||
def supported?
|
def supported?
|
||||||
Rails::SystemTestCase.driver.supports_screenshots? && !passed?
|
ActionSystemTest.driver.supports_screenshots? && !passed?
|
||||||
end
|
end
|
||||||
|
|
||||||
def image_path
|
def image_path
|
|
@ -0,0 +1,8 @@
|
||||||
|
require_relative "gem_version"
|
||||||
|
|
||||||
|
module ActionSystemTest
|
||||||
|
# Returns the version of the currently loaded Action System Test as a <tt>Gem::Version</tt>
|
||||||
|
def self.version
|
||||||
|
gem_version
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,13 @@
|
||||||
|
require "active_support/testing/autorun"
|
||||||
|
require "action_controller"
|
||||||
|
require "action_dispatch"
|
||||||
|
require "action_system_test"
|
||||||
|
|
||||||
|
# Skips the current run on Rubinius using Minitest::Assertions#skip
|
||||||
|
def rubinius_skip(message = "")
|
||||||
|
skip message if RUBY_ENGINE == "rbx"
|
||||||
|
end
|
||||||
|
# Skips the current run on JRuby using Minitest::Assertions#skip
|
||||||
|
def jruby_skip(message = "")
|
||||||
|
skip message if defined?(JRUBY_VERSION)
|
||||||
|
end
|
|
@ -0,0 +1,39 @@
|
||||||
|
require "abstract_unit"
|
||||||
|
|
||||||
|
class CapybaraDriverTest < ActiveSupport::TestCase
|
||||||
|
def setup
|
||||||
|
ActionSystemTest.driver = :poltergeist
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_default_driver_adapter
|
||||||
|
assert_kind_of ActionSystemTest::DriverAdapters::CapybaraDriver, ActionSystemTest.driver
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_default_settings
|
||||||
|
assert_equal :poltergeist, ActionSystemTest.driver.name
|
||||||
|
assert_equal :puma, ActionSystemTest.driver.server
|
||||||
|
assert_equal 28100, ActionSystemTest.driver.port
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_setting_driver
|
||||||
|
ActionSystemTest.driver = :webkit
|
||||||
|
|
||||||
|
assert_equal :webkit, ActionSystemTest.driver.name
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_setting_server
|
||||||
|
ActionSystemTest.driver = ActionSystemTest::DriverAdapters::CapybaraDriver.new(
|
||||||
|
server: :webrick
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_equal :webrick, ActionSystemTest.driver.server
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_setting_port
|
||||||
|
ActionSystemTest.driver = ActionSystemTest::DriverAdapters::CapybaraDriver.new(
|
||||||
|
port: 3000
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_equal 3000, ActionSystemTest.driver.port
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,11 +3,11 @@ require "abstract_unit"
|
||||||
class DriverAdapterTest < ActiveSupport::TestCase
|
class DriverAdapterTest < ActiveSupport::TestCase
|
||||||
test "only registered adapters are accepted" do
|
test "only registered adapters are accepted" do
|
||||||
assert_raises(NameError) do
|
assert_raises(NameError) do
|
||||||
Rails::SystemTestCase.driver = :whatever
|
ActionSystemTest.driver = :whatever
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_nothing_raised do
|
assert_nothing_raised do
|
||||||
Rails::SystemTestCase.driver = :rack_test
|
ActionSystemTest.driver = :rack_test
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -0,0 +1,11 @@
|
||||||
|
require "abstract_unit"
|
||||||
|
|
||||||
|
class RailsSeleniumDriverTest < ActiveSupport::TestCase
|
||||||
|
def setup
|
||||||
|
ActionSystemTest.driver = :rails_selenium_driver
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_default_driver_adapter
|
||||||
|
assert_kind_of ActionSystemTest::DriverAdapters::RailsSeleniumDriver, ActionSystemTest.driver
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,20 @@
|
||||||
|
require "abstract_unit"
|
||||||
|
|
||||||
|
class ScreenshotHelperTest < ActiveSupport::TestCase
|
||||||
|
def test_driver_support_for_screenshots
|
||||||
|
ActionSystemTest.driver = :rails_selenium_driver
|
||||||
|
assert ActionSystemTest.driver.supports_screenshots?
|
||||||
|
|
||||||
|
ActionSystemTest.driver = :rack_test
|
||||||
|
assert_not ActionSystemTest.driver.supports_screenshots?
|
||||||
|
|
||||||
|
ActionSystemTest.driver = :selenium
|
||||||
|
assert ActionSystemTest.driver.supports_screenshots?
|
||||||
|
|
||||||
|
ActionSystemTest.driver = :webkit
|
||||||
|
assert ActionSystemTest.driver.supports_screenshots?
|
||||||
|
|
||||||
|
ActionSystemTest.driver = :poltergeist
|
||||||
|
assert ActionSystemTest.driver.supports_screenshots?
|
||||||
|
end
|
||||||
|
end
|
|
@ -24,6 +24,7 @@ class Build
|
||||||
"av" => "actionview",
|
"av" => "actionview",
|
||||||
"aj" => "activejob",
|
"aj" => "activejob",
|
||||||
"ac" => "actioncable",
|
"ac" => "actioncable",
|
||||||
|
"ast" => "actionsystemtest",
|
||||||
"guides" => "guides"
|
"guides" => "guides"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +155,6 @@ ENV["GEM"].split(",").each do |gem|
|
||||||
|
|
||||||
build = Build.new(gem, isolated: isolated)
|
build = Build.new(gem, isolated: isolated)
|
||||||
results[build.key] = build.run!
|
results[build.key] = build.run!
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ require "rails"
|
||||||
action_cable/engine
|
action_cable/engine
|
||||||
rails/test_unit/railtie
|
rails/test_unit/railtie
|
||||||
sprockets/railtie
|
sprockets/railtie
|
||||||
system_testing/railtie
|
action_system_test/railtie
|
||||||
).each do |railtie|
|
).each do |railtie|
|
||||||
begin
|
begin
|
||||||
require railtie
|
require railtie
|
||||||
|
|
|
@ -14,7 +14,6 @@ require "action_view/railtie"
|
||||||
<%= comment_if :skip_action_cable %>require "action_cable/engine"
|
<%= comment_if :skip_action_cable %>require "action_cable/engine"
|
||||||
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
|
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
|
||||||
<%= comment_if :skip_test %>require "rails/test_unit/railtie"
|
<%= comment_if :skip_test %>require "rails/test_unit/railtie"
|
||||||
<%= comment_if :skip_system_test %>require "system_testing/railtie"
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
# Require the gems listed in Gemfile, including any gems
|
# Require the gems listed in Gemfile, including any gems
|
||||||
|
|
|
@ -11,7 +11,6 @@ require "action_view/railtie"
|
||||||
require "active_job/railtie"
|
require "active_job/railtie"
|
||||||
<%= comment_if :skip_action_cable %>require "action_cable/engine"
|
<%= comment_if :skip_action_cable %>require "action_cable/engine"
|
||||||
<%= comment_if :skip_test %>require "rails/test_unit/railtie"
|
<%= comment_if :skip_test %>require "rails/test_unit/railtie"
|
||||||
<%= comment_if :skip_system_test %>require "system_testing/railtie"
|
|
||||||
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
|
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class <%= class_name.pluralize %>Test < Rails::SystemTestCase
|
class <%= class_name.pluralize %>Test < ActionSystemTestCase
|
||||||
# test 'the truth' do
|
# test 'the truth' do
|
||||||
# assert true
|
# assert true
|
||||||
# end
|
# end
|
||||||
|
|
|
@ -7,7 +7,7 @@ require "active_support/test_case"
|
||||||
require "action_controller"
|
require "action_controller"
|
||||||
require "action_controller/test_case"
|
require "action_controller/test_case"
|
||||||
require "action_dispatch/testing/integration"
|
require "action_dispatch/testing/integration"
|
||||||
require "system_test_case"
|
require "action_system_test"
|
||||||
require "rails/generators/test_case"
|
require "rails/generators/test_case"
|
||||||
|
|
||||||
require "active_support/testing/autorun"
|
require "active_support/testing/autorun"
|
||||||
|
@ -46,7 +46,7 @@ class ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Rails::SystemTestCase
|
class ActionSystemTestCase
|
||||||
def before_setup # :nodoc:
|
def before_setup # :nodoc:
|
||||||
@routes = Rails.application.routes
|
@routes = Rails.application.routes
|
||||||
super
|
super
|
||||||
|
|
|
@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
||||||
|
|
||||||
s.add_dependency "activesupport", version
|
s.add_dependency "activesupport", version
|
||||||
s.add_dependency "actionpack", version
|
s.add_dependency "actionpack", version
|
||||||
|
s.add_dependency "actionsystemtest", version
|
||||||
|
|
||||||
s.add_dependency "rake", ">= 0.8.7"
|
s.add_dependency "rake", ">= 0.8.7"
|
||||||
s.add_dependency "thor", ">= 0.18.1", "< 2.0"
|
s.add_dependency "thor", ">= 0.18.1", "< 2.0"
|
||||||
|
|
|
@ -64,7 +64,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
|
||||||
|
|
||||||
# System tests
|
# System tests
|
||||||
assert_file "test/system/product_lines_test.rb" do |test|
|
assert_file "test/system/product_lines_test.rb" do |test|
|
||||||
assert_match(/class ProductLinesTest < Rails::SystemTestCase/, test)
|
assert_match(/class ProductLinesTest < ActionSystemTestCase/, test)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Views
|
# Views
|
||||||
|
|
|
@ -7,6 +7,6 @@ class SystemTestGeneratorTest < Rails::Generators::TestCase
|
||||||
|
|
||||||
def test_system_test_skeleton_is_created
|
def test_system_test_skeleton_is_created
|
||||||
run_generator
|
run_generator
|
||||||
assert_file "test/system/users_test.rb", /class UsersTest < Rails::SystemTestCase/
|
assert_file "test/system/users_test.rb", /class UsersTest < ActionSystemTestCase/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue