Skip to content
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
21 changes: 20 additions & 1 deletion test/cases/coerced_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,26 @@ def test_partial_index_coerced
end
end

module ActiveRecord
class Migration::IndexTest < ActiveRecord::TestCase
# SQL Server requires an explicit truthy comparison for BIT columns.
coerce_tests! :test_rename_index_preserves_where_clause
def test_rename_index_preserves_where_clause_coerced
skip unless connection.supports_partial_index?

# Keep the names short to make Oracle and similar behave.
connection.add_index(table_name, [:foo], name: "old_idx", where: "administrator = 1")
old_where = connection.indexes(table_name).find { |i| i.name == "old_idx" }.where

connection.rename_index(table_name, "old_idx", "new_idx")

new_index = connection.indexes(table_name).find { |i| i.name == "new_idx" }
assert_not_nil new_index
assert_equal old_where, new_index.where
end
end
end

module ActiveRecord
class AdapterTest < ActiveRecord::TestCase
# Legacy binds are not supported.
Expand Down Expand Up @@ -2039,7 +2059,6 @@ class UnsafeRawSqlTest < ActiveRecord::TestCase
test "order: allows nested functions" do
ids_expected = Post.order(Arel.sql("author_id, len(trim(title))")).pluck(:id)

# $DEBUG = true
ids = Post.order("author_id, len(trim(title))").pluck(:id)

assert_equal ids_expected, ids
Expand Down
Loading