Skip to content

Commit f793cdd

Browse files
pjurewiczclaude
andcommitted
Expect inner join on event-filtered reads from several streams
The joins(:event) calls in the multi-stream read scope survived mutation testing on CI - with includes(:event) already in place their removal degrades the query to an eager-loaded outer join instead of breaking it. Pin the inner join in a query-shape spec, mirroring the existing single-stream expectation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 7761419 commit f793cdd

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

ruby_event_store-active_record/spec/event_repository_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,21 @@ module ActiveRecord
294294
}.to match_query_count(1)
295295
end
296296

297+
specify "inner join events when event filtering criteria present in several streams read" do
298+
scope = specification.streams("stream", "other")
299+
[
300+
scope.of_type("type"),
301+
scope.as_of,
302+
scope.as_at,
303+
scope.older_than(Time.now),
304+
scope.older_than_or_equal(Time.now),
305+
scope.newer_than(Time.now),
306+
scope.newer_than_or_equal(Time.now),
307+
].each do |spec|
308+
expect { repository.read(spec.result).to_a }.to match_query(/INNER\s+JOIN\s+.event_store_events./)
309+
end
310+
end
311+
297312
specify "don't join events when no event filtering criteria when counting" do
298313
expect { repository.count(specification.stream("stream").result) }.to match_query(
299314
/

0 commit comments

Comments
 (0)