We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 787b81b + 9f79ad0 commit 05dc093Copy full SHA for 05dc093
activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
@@ -521,9 +521,13 @@ def test_only_check_for_insensitive_comparison_capability_once
521
522
def test_ignores_warnings_when_behaviour_ignore
523
with_db_warnings_action(:ignore) do
524
- result = @connection.execute("do $$ BEGIN RAISE WARNING 'foo'; END; $$")
525
-
526
- assert_equal [], result.to_a
+ # libpq prints a warning to stderr from C, so we need to stub
+ # the whole file descriptors, not just Ruby's $stdout/$stderr.
+ _out, err = capture_subprocess_io do
527
+ result = @connection.execute("do $$ BEGIN RAISE WARNING 'foo'; END; $$")
528
+ assert_equal [], result.to_a
529
+ end
530
+ assert_match(/WARNING: foo/, err)
531
end
532
533
0 commit comments