Skip to content

Commit

Permalink
additional tests of batch enumerators optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
pjurewicz committed Dec 7, 2023
1 parent 7b492f6 commit 6cfa14f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ruby_event_store-active_record/spec/batch_enumerator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ module ActiveRecord
expect(reader).to receive(:call).with(kind_of(Integer), kind_of(Integer)).and_return([[], nil])
BatchEnumerator.new(100, Float::INFINITY, reader).to_a
end

specify "ensure not fetching next batch if the previous one was smaller than specified batch size" do
expect(reader).to receive(:call).exactly(4).times.and_call_original
expect(BatchEnumerator.new(3000, Float::INFINITY, reader).to_a)
end
end
end
end
5 changes: 5 additions & 0 deletions ruby_event_store/spec/batch_enumerator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,10 @@ module RubyEventStore
expect(reader = double(:reader)).to receive(:call).with(kind_of(Numeric), kind_of(Numeric)).and_return([])
BatchEnumerator.new(100, Float::INFINITY, reader).to_a
end

specify "ensure not fetching next batch if the previous one was smaller than specified batch size" do
expect(reader).to receive(:call).exactly(4).times.and_call_original
expect(BatchEnumerator.new(3000, Float::INFINITY, reader).to_a)
end
end
end

0 comments on commit 6cfa14f

Please sign in to comment.