Skip to content

Commit 1f91c61

Browse files
committed
fix(test): Ensure $stdout is always restored
This fixes the `IOError` we could encounter in tests. Found using: ```ruby def bugmsg(header, stdout) bugged = begin; print; rescue IOError; "💥 "; end STDOUT.puts "🤞#{header.rjust(17)}: stdout=#{stdout.inspect} " \ "#{bugged}(at #{caller_locations(2, 1).first})" end trace_var :$stdout, (proc { bugmsg("$stdout=", _1) }) TracePoint.trace(:a_return) do |tp| next unless tp.method_id == :reopen && tp.self == $stdout bugmsg("$stdout#reopen", $stdout) end ```
1 parent b247ca0 commit 1f91c61

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/cases/schema_dumper_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def down
8383
end
8484
ensure
8585
migration.migrate(:down)
86-
# $stdout = original
86+
$stdout = original
8787
end
8888

8989
def test_timestamps_schema_dump_before_rails_7_with_timestamptz_setting
@@ -119,7 +119,7 @@ def down
119119
end
120120
ensure
121121
migration.migrate(:down)
122-
# $stdout = original
122+
$stdout = original
123123
end
124124

125125
def test_schema_dump_with_correct_timestamp_types_via_add_column_before_rails_7_with_timestamptz_setting
@@ -153,7 +153,7 @@ def down
153153
end
154154
ensure
155155
migration.migrate(:down)
156-
# $stdout = original
156+
$stdout = original
157157
end
158158

159159
def test_schema_dump_when_changing_datetime_type_for_an_existing_app

0 commit comments

Comments
 (0)