Skip to content

Commit 986cd98

Browse files
raymasiclatclaude
andcommitted
test: add multi-type polymorphic-array spec
The existing array-of-sources test only exercises a single-type array (`Link.where(source: [cat])`). The fix's value also covers multi-type arrays (`Link.where(source: [cat, dog])`) — a broader branch of `type_to_ids_mapping` where the result hash spans multiple keys. Locks in coverage on both Rails 8.0 (backwards compat) and 8.1. Suggested by code review. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c5f3319 commit 986cd98

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

spec/polymorphic_integer_type_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@
136136
expect(Link.where(source: [source])).to eq [link]
137137
end
138138

139+
it "properly finds objects when passing an array of mixed-type sources" do
140+
link_for_dog = Link.create(source: dog)
141+
expect(Link.where(source: [cat, dog])).to match_array [link, link_for_dog]
142+
end
143+
139144
it "properly finds the object with a find_by" do
140145
expect(Link.find_by(source: source, id: link.id)).to eql link
141146
end

0 commit comments

Comments
 (0)