Skip to content

Commit

Permalink
Merge pull request #48850 from zzak/re-48824
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Jul 30, 2023
2 parents c78432b + a599ea8 commit 3569523
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions activerecord/test/cases/connection_adapters/schema_cache_test.rb
Expand Up @@ -407,6 +407,30 @@ def test_when_lazily_load_schema_cache_is_set_cache_is_lazily_populated_when_est
assert_same coder["columns"], schema_cache.instance_variable_get(:@columns)
end

test "#encode_with sorts members" do
values = [["z", nil], ["y", nil], ["x", nil]]
expected = values.sort.to_h

coder = {
"columns" => values,
"primary_keys" => values,
"data_sources" => values,
"indexes" => values,
"deduplicated" => true
}

schema_cache = SchemaCache.allocate
schema_cache.init_with(coder)
schema_cache.encode_with(coder)

assert_equal expected, coder["columns"]
assert_equal expected, coder["primary_keys"]
assert_equal expected, coder["data_sources"]
assert_equal expected, coder["indexes"]
assert coder.key?("version")
assert coder.key?("database_version")
end

private
def schema_dump_path
"#{ASSETS_ROOT}/schema_dump_5_1.yml"
Expand Down

0 comments on commit 3569523

Please sign in to comment.