Skip to content

Commit 00761d5

Browse files
committed
Hide test_unit generators when using other test framework
1 parent b8720e7 commit 00761d5

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

railties/lib/rails/generators.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ def hidden_namespaces
157157
"action_text:install",
158158
"action_mailbox:install",
159159
"devcontainer"
160-
]
160+
].tap do |h|
161+
h << "test_unit" if test.to_s != "test_unit"
162+
end
161163
end
162164
end
163165

railties/test/application/generators_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,15 @@ def check_expected
203203
end
204204
end
205205

206+
test "help hides test_unit when using another test_framework" do
207+
add_to_config <<-RUBY
208+
config.generators.test_framework :rspec
209+
RUBY
210+
211+
output = rails("generate", "--help")
212+
assert_no_match "test_unit", output
213+
end
214+
206215
test "skip collision check" do
207216
rails("generate", "model", "post", "title:string")
208217

0 commit comments

Comments
 (0)