Skip to content

Commit 12fc492

Browse files
committed
check for system test existence before modifying
fixes #559 With this change the scaffold generator no longer assumes the existence of a system test file. Rails projects can be initialized without system tests using the --skip-system-test option.
1 parent ed7d059 commit 12fc492

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/generators/test_unit/scaffold/scaffold_generator.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ module TestUnit # :nodoc:
44
module Generators # :nodoc:
55
class ScaffoldGenerator < Base # :nodoc:
66
def fix_system_test
7-
if turbo_defined?
8-
gsub_file File.join("test/system", class_path, "#{file_name.pluralize}_test.rb"),
7+
system_test_file = File.join("test/system", class_path, "#{file_name.pluralize}_test.rb")
8+
if turbo_defined? && File.exist?(system_test_file)
9+
gsub_file system_test_file,
910
/(click_on.*Destroy this.*)$/,
1011
"accept_confirm { \\1 }"
1112
end

0 commit comments

Comments
 (0)