提交 5bf0aa67 编写于 作者: E eileencodes

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.
上级 a21e18d5
......@@ -36,7 +36,7 @@ env:
matrix:
- "GEM=railties"
- "GEM=ap,ac"
- "GEM=am,amo,as,av,aj"
- "GEM=am,amo,as,av,aj,ast"
- "GEM=as PRESERVE_TIMEZONES=1"
- "GEM=ar:mysql2"
- "GEM=ar:sqlite3"
......
......@@ -45,11 +45,14 @@ PATH
actionpack (5.1.0.alpha)
actionview (= 5.1.0.alpha)
activesupport (= 5.1.0.alpha)
capybara (~> 2.7.0)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
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)
activesupport (= 5.1.0.alpha)
builder (~> 3.1)
......@@ -84,6 +87,7 @@ PATH
sprockets-rails (>= 2.0.0)
railties (5.1.0.alpha)
actionpack (= 5.1.0.alpha)
actionsystemtest (= 5.1.0.alpha)
activesupport (= 5.1.0.alpha)
method_source
rake (>= 0.8.7)
......@@ -126,7 +130,7 @@ GEM
bunny (2.6.2)
amq-protocol (>= 2.0.1)
byebug (9.0.6)
capybara (2.7.0)
capybara (2.7.1)
addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
......
......@@ -26,7 +26,6 @@
s.add_dependency "rails-html-sanitizer", "~> 1.0", ">= 1.0.2"
s.add_dependency "rails-dom-testing", "~> 2.0"
s.add_dependency "actionview", version
s.add_dependency "capybara", "~> 2.7.0"
s.add_development_dependency "activemodel", version
end
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_dispatch"
require "active_support/dependencies"
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 "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
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
* Added to Rails!
*Eileen M. Uchitelle*
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.
# 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
```
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
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
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
require "system_testing/driver_adapters"
require "action_system_test/driver_adapters"
module SystemTesting
# The <tt>SystemTesting::DriverAdapter</tt> module is used to load the driver
module ActionSystemTest
# The <tt>ActionSystemTest::DriverAdapter</tt> module is used to load the driver
# set in your Rails' test configuration file.
#
# The default driver adapter is the +:rails_selenium_driver+.
......
module SystemTesting
module ActionSystemTest
# == System Testing Driver Adapters
#
# By default Rails supports Capybara with the Selenium Driver. Rails provides
......@@ -29,8 +29,8 @@ module DriverAdapters
class << self
# Returns driver for specified name.
#
# SystemTesting::DriverAdapters.lookup(:rails_selenium_driver)
# # => SystemTesting::DriverAdapters::RailsSeleniumDriver
# ActionSystemTest::DriverAdapters.lookup(:rails_selenium_driver)
# # => ActionSystemTest::DriverAdapters::RailsSeleniumDriver
def lookup(driver)
if CapybaraDriver::CAPYBARA_DEFAULTS.include?(driver)
CapybaraDriver.new(name: driver)
......
require "system_testing/driver_adapters/web_server"
require "action_system_test/driver_adapters/web_server"
module SystemTesting
module ActionSystemTest
module DriverAdapters
# == CapybaraDriver for System Testing
#
......@@ -29,7 +29,7 @@ module DriverAdapters
#
# The default settings for the <tt>CapybaraDriver</tt> are:
#
# #<SystemTesting::DriverAdapters::CapybaraDriver:0x007ff0e992c1d8
# #<ActionSystemTest::DriverAdapters::CapybaraDriver:0x007ff0e992c1d8
# @name=:rack_test,
# @server=:puma,
# @port=28100
......@@ -38,7 +38,7 @@ module DriverAdapters
# The settings for the <tt>CapybaraDriver</tt> can be changed from
# Rails' configuration file.
#
# config.system_testing.driver = SystemTesting::DriverAdapters::CapybaraDriver.new(
# config.system_testing.driver = ActionSystemTest::DriverAdapters::CapybaraDriver.new(
# name: :webkit,
# server: :webrick
# )
......
require "system_testing/driver_adapters/web_server"
require "action_system_test/driver_adapters/web_server"
module SystemTesting
module ActionSystemTest
module DriverAdapters
# == RailsSeleniumDriver for System Testing
#
......@@ -23,7 +23,7 @@ module DriverAdapters
# by default. The default settings for the <tt>RailsSeleniumDriver</tt>
# are as follows:
#
# #<SystemTesting::DriverAdapters::RailsSeleniumDriver:0x007ff0e992c1d8
# #<ActionSystemTest::DriverAdapters::RailsSeleniumDriver:0x007ff0e992c1d8
# @browser=:chrome,
# @server=:puma,
# @port=28100,
......@@ -33,7 +33,7 @@ module DriverAdapters
# The settings for the <tt>RailsSeleniumDriver</tt> can be changed in the
# Rails configuration file.
#
# config.system_testing.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
# config.system_testing.driver = ActionSystemTest::DriverAdapters::RailsSeleniumDriver.new(
# server: :webrick,
# port: 28100,
# screen_size: [ 800, 800 ]
......@@ -46,7 +46,7 @@ module DriverAdapters
# +:chrome+ to +:firefox+, initialize the Selenium driver in your Rails'
# test environment:
#
# config.system_testing.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new(
# config.system_testing.driver = ActionSystemTest::DriverAdapters::RailsSeleniumDriver.new(
# browser: :firefox
# )
class RailsSeleniumDriver
......@@ -54,7 +54,7 @@ class RailsSeleniumDriver
attr_reader :browser, :server, :port, :screen_size
def initialize(browser: :chrome, server: :puma, port: 28100, screen_size: [ 1400,1400 ]) # :nodoc:
def initialize(browser: :chrome, server: :puma, port: 28100, screen_size: [ 1400, 1400 ]) # :nodoc:
@browser = browser
@server = server
@port = port
......
......@@ -4,7 +4,7 @@
false
end
module SystemTesting
module ActionSystemTest
module DriverAdapters
module WebServer # :nodoc:
def register_server
......@@ -13,7 +13,7 @@ def register_server
when :puma
register_puma(app, port)
when :webrick
register_webrick(app, port, host)
register_webrick(app, port)
else
register_default(app, port)
end
......
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
require "system_test_case"
require "action_system_test"
module SystemTesting
module ActionSystemTest
# = System Testing Railtie
class Railtie < Rails::Railtie # :nodoc:
config.system_testing = ActiveSupport::OrderedOptions.new
initializer "system_testing.set_configs" do |app|
options = app.config.system_testing
options.driver ||= Rails::SystemTestCase.default_driver
options.driver ||= ActionSystemTest.default_driver
ActiveSupport.on_load(:system_testing) do
options.each { |k,v| send("#{k}=", v) }
......
require "capybara/dsl"
require "system_testing/test_helpers"
require "action_system_test/test_helpers"
module SystemTesting
module ActionSystemTest
module TestHelper # :nodoc:
include TestHelpers::Assertions
include TestHelpers::FormHelper
......
module SystemTesting
module ActionSystemTest
module TestHelpers
extend ActiveSupport::Autoload
......
module SystemTesting
module ActionSystemTest
module TestHelpers
# Assertions for system testing that aren't included by default in Capybara.
# These are assertions that are useful specifically for Rails applications.
......
module SystemTesting
module ActionSystemTest
module TestHelpers
# Form helpers for system testing that aren't included by default in
# Capybara.
......
module SystemTesting
module ActionSystemTest
module TestHelpers
# Screenshot helper for system testing
module ScreenshotHelper
......@@ -11,7 +11,7 @@ module ScreenshotHelper
#
# You can check of the driver supports screenshots by running
#
# Rails::SystemTestCase.driver.supports_screenshots?
# ActionSystemTest.driver.supports_screenshots?
# => true
def take_screenshot
puts "[Screenshot]: #{image_path}"
......@@ -20,7 +20,7 @@ def take_screenshot
private
def supported?
Rails::SystemTestCase.driver.supports_screenshots? && !passed?
ActionSystemTest.driver.supports_screenshots? && !passed?
end
def image_path
......
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
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
......@@ -2,38 +2,38 @@
class CapybaraDriverTest < ActiveSupport::TestCase
def setup
Rails::SystemTestCase.driver = :poltergeist
ActionSystemTest.driver = :poltergeist
end
def test_default_driver_adapter
assert_kind_of SystemTesting::DriverAdapters::CapybaraDriver, Rails::SystemTestCase.driver
assert_kind_of ActionSystemTest::DriverAdapters::CapybaraDriver, ActionSystemTest.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
assert_equal :poltergeist, ActionSystemTest.driver.name
assert_equal :puma, ActionSystemTest.driver.server
assert_equal 28100, ActionSystemTest.driver.port
end
def test_setting_driver
Rails::SystemTestCase.driver = :webkit
ActionSystemTest.driver = :webkit
assert_equal :webkit, Rails::SystemTestCase.driver.name
assert_equal :webkit, ActionSystemTest.driver.name
end
def test_setting_server
Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraDriver.new(
ActionSystemTest.driver = ActionSystemTest::DriverAdapters::CapybaraDriver.new(
server: :webrick
)
assert_equal :webrick, Rails::SystemTestCase.driver.server
assert_equal :webrick, ActionSystemTest.driver.server
end
def test_setting_port
Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::CapybaraDriver.new(
ActionSystemTest.driver = ActionSystemTest::DriverAdapters::CapybaraDriver.new(
port: 3000
)
assert_equal 3000, Rails::SystemTestCase.driver.port
assert_equal 3000, ActionSystemTest.driver.port
end
end
......@@ -3,11 +3,11 @@
class DriverAdapterTest < ActiveSupport::TestCase
test "only registered adapters are accepted" do
assert_raises(NameError) do
Rails::SystemTestCase.driver = :whatever
ActionSystemTest.driver = :whatever
end
assert_nothing_raised do
Rails::SystemTestCase.driver = :rack_test
ActionSystemTest.driver = :rack_test
end
end
end
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
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",
"aj" => "activejob",
"ac" => "actioncable",
"ast" => "actionsystemtest",
"guides" => "guides"
}
......@@ -154,7 +155,6 @@ def run_bug_report_templates
build = Build.new(gem, isolated: isolated)
results[build.key] = build.run!
end
end
......
......@@ -9,7 +9,7 @@
action_cable/engine
rails/test_unit/railtie
sprockets/railtie
system_testing/railtie
action_system_test/railtie
).each do |railtie|
begin
require railtie
......
......@@ -14,7 +14,6 @@
<%= comment_if :skip_action_cable %>require "action_cable/engine"
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
<%= comment_if :skip_test %>require "rails/test_unit/railtie"
<%= comment_if :skip_system_test %>require "system_testing/railtie"
<% end -%>
# Require the gems listed in Gemfile, including any gems
......
......@@ -11,7 +11,6 @@
require "active_job/railtie"
<%= comment_if :skip_action_cable %>require "action_cable/engine"
<%= 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"
<% end -%>
......
require 'test_helper'
class <%= class_name.pluralize %>Test < Rails::SystemTestCase
class <%= class_name.pluralize %>Test < ActionSystemTestCase
# test 'the truth' do
# assert true
# end
......
......@@ -7,7 +7,7 @@
require "action_controller"
require "action_controller/test_case"
require "action_dispatch/testing/integration"
require "system_test_case"
require "action_system_test"
require "rails/generators/test_case"
require "active_support/testing/autorun"
......@@ -46,7 +46,7 @@ def before_setup # :nodoc:
end
end
class Rails::SystemTestCase
class ActionSystemTestCase
def before_setup # :nodoc:
@routes = Rails.application.routes
super
......
......@@ -25,6 +25,7 @@
s.add_dependency "activesupport", version
s.add_dependency "actionpack", version
s.add_dependency "actionsystemtest", version
s.add_dependency "rake", ">= 0.8.7"
s.add_dependency "thor", ">= 0.18.1", "< 2.0"
......
......@@ -64,7 +64,7 @@ def test_scaffold_on_invoke
# System tests
assert_file "test/system/product_lines_test.rb" do |test|
assert_match(/class ProductLinesTest < Rails::SystemTestCase/, test)
assert_match(/class ProductLinesTest < ActionSystemTestCase/, test)
end
# Views
......
......@@ -7,6 +7,6 @@ class SystemTestGeneratorTest < Rails::Generators::TestCase
def test_system_test_skeleton_is_created
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册