From 5b9aa43bc8dafcc2a00eb43741c495262f5ca45e Mon Sep 17 00:00:00 2001 From: eileencodes Date: Fri, 5 Aug 2016 09:36:54 -0400 Subject: 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 --- .../rails/generators/test_unit/system/system_generator.rb | 13 +++++++++++++ .../generators/test_unit/system/templates/system_test.rb | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100644 railties/lib/rails/generators/test_unit/system/system_generator.rb create mode 100644 railties/lib/rails/generators/test_unit/system/templates/system_test.rb (limited to 'railties/lib/rails/generators/test_unit') 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 -- cgit v1.2.3