Skip to content

Commit

Permalink
test against using inner joins
Browse files Browse the repository at this point in the history
  • Loading branch information
pjurewicz committed Dec 6, 2023
1 parent 3c50616 commit b443ac2
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion ruby_event_store-active_record/spec/event_repository_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module ActiveRecord

it_behaves_like :event_repository, mk_repository, helper


let(:repository) { mk_repository.call }
let(:specification) do
Specification.new(
Expand Down Expand Up @@ -277,6 +276,22 @@ module ActiveRecord
}x
end

specify 'inner join events when event filtering criteria present' do
[
specification.stream("stream").of_type("type"),
specification.stream("stream").as_of,
specification.stream("stream").as_at,
specification.stream("stream").older_than(Time.now),
specification.stream("stream").older_than_or_equal(Time.now),
specification.stream("stream").newer_than(Time.now),
specification.stream("stream").newer_than_or_equal(Time.now),
].each do |spec|
expect {
repository.read(spec.result).to_a
}.to match_query /INNER\s+JOIN\s+.event_store_events./
end
end

specify "don't join events when no event filtering criteria when counting" do
expect {
repository.count(specification.stream("stream").result)
Expand Down

0 comments on commit b443ac2

Please sign in to comment.