aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/test_unit
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2016-08-05 09:36:54 -0400
committereileencodes <eileencodes@gmail.com>2017-02-20 15:07:31 -0500
commit5b9aa43bc8dafcc2a00eb43741c495262f5ca45e (patch)
treea7e843d12987cf033c4d5601dff3abc6ca05e2e6 /railties/lib/rails/generators/test_unit
parente9abbb700acd8165a8994d8b2a700e507fb3b7ff (diff)
downloadrails-5b9aa43bc8dafcc2a00eb43741c495262f5ca45e.tar.gz
rails-5b9aa43bc8dafcc2a00eb43741c495262f5ca45e.tar.bz2
rails-5b9aa43bc8dafcc2a00eb43741c495262f5ca45e.zip
Add generators and ability to run system tests
* Generates system test requirements with new Rails app * Includes required default gems in Gemfile for Rails app * Generates a single system test case * Generates a system test case with scaffold
Diffstat (limited to 'railties/lib/rails/generators/test_unit')
-rw-r--r--railties/lib/rails/generators/test_unit/system/system_generator.rb13
-rw-r--r--railties/lib/rails/generators/test_unit/system/templates/system_test.rb7
2 files changed, 20 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/test_unit/system/system_generator.rb b/railties/lib/rails/generators/test_unit/system/system_generator.rb
new file mode 100644
index 0000000000..4d3b37e645
--- /dev/null
+++ b/railties/lib/rails/generators/test_unit/system/system_generator.rb
@@ -0,0 +1,13 @@
+require 'rails/generators/test_unit'
+
+module TestUnit # :nodoc:
+ module Generators # :nodoc:
+ class SystemGenerator < Base # :nodoc:
+ check_class_collision suffix: "Test"
+
+ def create_test_files
+ template "system_test.rb", File.join("test/system", class_path, "#{file_name.pluralize}_test.rb")
+ end
+ end
+ end
+end
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
new file mode 100644
index 0000000000..75825c880d
--- /dev/null
+++ b/railties/lib/rails/generators/test_unit/system/templates/system_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class <%= class_name.pluralize %>Test < Rails::SystemTestCase
+ # test 'the truth' do
+ # assert true
+ # end
+end