Skip to content

Commit 0e96058

Browse files
authored
Merge pull request #590 from rails/flavorjones/586-fix-scaffold
Rails 8.1 system test support
2 parents 7fb4975 + 770b8e9 commit 0e96058

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

.github/workflows/upstream.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
fail-fast: false
4242
matrix:
4343
plat: ["ubuntu"]
44-
ref: ["7-2-stable", "8-0-stable", "main"]
44+
ref: ["7-2-stable", "8-0-stable", "8-1-stable", "main"]
4545
env:
4646
RAILSOPTS: --git=https://github.com/rails/rails --ref=${{ matrix.ref }}
4747
steps:

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# `tailwindcss-rails` Changelog
22

3+
## next / unreleased
4+
5+
### Improved
6+
7+
* Support Rails 8.1 scaffolding which disables system tests by default. #585 @flavorjones
8+
9+
310
## v4.3.0 / 2025-07-06
411

512
### Improved

lib/generators/test_unit/scaffold/scaffold_generator.rb

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

test/integration/user_install_test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,12 @@ if [[ $(rails -v) > "Rails 8.0.0.beta" ]] ; then
6969
grep -q PasswordsController app/controllers/passwords_controller.rb
7070
fi
7171

72+
# TEST: doesn't fail when not generating system tests
73+
bin/rails generate scaffold memo title:string body:text published:boolean --system-tests=false
74+
grep -q "Show" app/views/memos/index.html.erb
75+
7276
# TEST: presence of the generated file
73-
bin/rails generate scaffold post title:string body:text published:boolean
77+
bin/rails generate scaffold post title:string body:text published:boolean --system-tests=true
7478
grep -q "Show" app/views/posts/index.html.erb
7579

7680
# TEST: the "accept_confirm" system test change was applied cleanly

0 commit comments

Comments
 (0)