Skip to content

Commit 2b4909b

Browse files
Improve generator logging and debugging
This commit is a follow-up to rails#49448, with regards to [this comment][]. Prior to this commit, logging and debugging for [Rails::Generators::Actions][] was limited even when enabling `RAILS_LOG_TO_STDOUT`. This was because the private `action` method in the corresponding test was capturing `$stdout`. [this comment]: rails#49448 (comment) [Rails::Generators::Actions]: https://api.rubyonrails.org/v7.0.8/classes/Rails/Generators/Actions.html
1 parent 5cfb100 commit 2b4909b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

railties/test/generators/actions_test.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,11 @@ def test_log_with_status_with_quiet
720720

721721
private
722722
def action(...)
723-
capture(:stdout) { generator.send(...) }
723+
if ENV["RAILS_LOG_TO_STDOUT"] == "true"
724+
generator.send(...)
725+
else
726+
capture(:stdout) { generator.send(...) }
727+
end
724728
end
725729

726730
def revoke(...)

0 commit comments

Comments
 (0)