Skip to content

Fix tests for Rails 6.1.4 #931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/cases/coerced_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,7 @@ def test_statement_cache_values_differ_coerced

original_test_statement_cache_values_differ
ensure
Book.where(author_id: nil, name: 'my book').delete_all
Book.connection.add_index(:books, [:author_id, :name], unique: true)
end
end
Expand Down Expand Up @@ -1748,6 +1749,7 @@ class EnumTest < ActiveRecord::TestCase

send(:'original_enums are distinct per class')
ensure
Book.where(author_id: nil, name: nil).delete_all
Book.connection.add_index(:books, [:author_id, :name], unique: true)
end

Expand All @@ -1758,6 +1760,7 @@ class EnumTest < ActiveRecord::TestCase

send(:'original_creating new objects with enum scopes')
ensure
Book.where(author_id: nil, name: nil).delete_all
Book.connection.add_index(:books, [:author_id, :name], unique: true)
end

Expand All @@ -1768,6 +1771,7 @@ class EnumTest < ActiveRecord::TestCase

send(:'original_enums are inheritable')
ensure
Book.where(author_id: nil, name: nil).delete_all
Book.connection.add_index(:books, [:author_id, :name], unique: true)
end

Expand All @@ -1778,6 +1782,7 @@ class EnumTest < ActiveRecord::TestCase

send(:'original_declare multiple enums at a time')
ensure
Book.where(author_id: nil, name: nil).delete_all
Book.connection.add_index(:books, [:author_id, :name], unique: true)
end
end
Expand Down Expand Up @@ -1843,6 +1848,14 @@ class LogSubscriberTest < ActiveRecord::TestCase
def test_vebose_query_logs_coerced
original_test_vebose_query_logs
end

# Bindings logged slightly differently.
coerce_tests! :test_where_in_binds_logging_include_attribute_names
def test_where_in_binds_logging_include_attribute_names_coerced
Developer.where(id: [1, 2, 3, 4, 5]).load
wait
assert_match(%{@0 = 1, @1 = 2, @2 = 3, @3 = 4, @4 = 5 [["id", nil], ["id", nil], ["id", nil], ["id", nil], ["id", nil]]}, @logger.logged(:debug).last)
end
end

class ActiveRecordSchemaTest < ActiveRecord::TestCase
Expand Down