Skip to content

Commit

Permalink
Fix output in tests
Browse files Browse the repository at this point in the history
PR #47191 added tests that create tables, but didn't turn off verbose
mode, so running tests caused unintended output. Sets verbose to false
for both tests.
  • Loading branch information
eileencodes committed Feb 22, 2023
1 parent e81c2bc commit 288ef49
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions activerecord/test/cases/serialized_attribute_test.rb
Expand Up @@ -406,6 +406,9 @@ def test_values_cast_from_nil_are_persisted_as_nil
# MySQL doesn't support default values for text columns, so we need to skip this test for MySQL
if !current_adapter?(:Mysql2Adapter)
def test_serialized_attribute_with_default_can_update_to_default
@verbose_was = ActiveRecord::Migration.verbose
ActiveRecord::Migration.verbose = false

ActiveRecord::Schema.define do
create_table :tmp_posts, force: true do |t|
t.text :content, null: false, default: "{}"
Expand All @@ -421,9 +424,14 @@ def test_serialized_attribute_with_default_can_update_to_default

t.update!(content: {})
assert_equal({}, t.content)
ensure
ActiveRecord::Migration.verbose = @verbose_was
end

def test_nil_is_always_persisted_as_default
@verbose_was = ActiveRecord::Migration.verbose
ActiveRecord::Migration.verbose = false

ActiveRecord::Schema.define do
create_table :tmp_posts, force: true do |t|
t.text :content, null: false, default: "{}"
Expand All @@ -437,6 +445,8 @@ def test_nil_is_always_persisted_as_default
t = klass.create!(content: { foo: "bar" })
t.update_attribute :content, nil
assert_equal({}, t.content)
ensure
ActiveRecord::Migration.verbose = @verbose_was
end
end

Expand Down

0 comments on commit 288ef49

Please sign in to comment.