ruby_event_store 2.11.1 → 2.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42bbf61dbcbf45fdbe2c3722b3bde03762f2f403a54181a80b12e1f5143e09f5
4
- data.tar.gz: 0a25ade531598979dbb18bb858cdfe8bd462f389e9016f94b08b8ecf46f521f0
3
+ metadata.gz: 340c04c1b68fa8cebc285043301c1f4f18a3991f3b8907902867fa8ea58fba1e
4
+ data.tar.gz: 5f2e265af27f9d41aa973f7330269ed8364e59d598a944a1727d2e586e23760b
5
5
  SHA512:
6
- metadata.gz: 5e9fd721927c9b369cb91fde201fe63533f370a94c4baff675bc68de4049d924fdf3d20bb1d16e24cf0bea57529b9f46316274a258464c274254cd35575b8656
7
- data.tar.gz: e7e5f244c7811f652c933102c686bc24fed30197fad8193bfbc412976411c1027632f786b25b67efe9778e46c076312d15957dd2d855eae583bd91ae02625440
6
+ metadata.gz: c659b73c074917ea247b21bbdeed50c4c69398ad17ad6bafa36643c906e762b024def7585375f8d5ebe43df8af5d20d0567e7060f50970907e75a79a5b8c96cb
7
+ data.tar.gz: ed1c6f434bccb600c849b9e726c97493af2bb75453edf97d0da3d03d71de0a9084ae900d14259638a8357afb5d6298b124a63df689b9c465d965b146ef67bab0
@@ -220,7 +220,10 @@ module RubyEventStore
220
220
  end
221
221
 
222
222
  def index_of(source, event_id)
223
- source.index { |item| item.event_id.eql?(event_id) }
223
+ index = source.index { |item| item.event_id.eql?(event_id) }
224
+ raise EventNotFound.new(event_id) unless index
225
+
226
+ index
224
227
  end
225
228
 
226
229
  def compute_position(resolved_version, index)
@@ -38,7 +38,7 @@ module RubyEventStore
38
38
  let(:stream) { Stream.new(SecureRandom.uuid) }
39
39
  let(:stream_flow) { Stream.new("flow") }
40
40
  let(:stream_other) { Stream.new("other") }
41
- let(:stream_test) { Stream.new("test") }
41
+
42
42
  let(:version_none) { ExpectedVersion.none }
43
43
  let(:version_auto) { ExpectedVersion.auto }
44
44
  let(:version_any) { ExpectedVersion.any }
@@ -1055,6 +1055,36 @@ module RubyEventStore
1055
1055
  expect(repository.read(specification.to(events[4].event_id).backward.read_last.result)).to be_nil
1056
1056
  end
1057
1057
 
1058
+ specify do
1059
+ event = SRecord.new
1060
+ repository.append_to_stream([event], Stream.new('dummy'), ExpectedVersion.any)
1061
+ expect do
1062
+ repository.read(specification.stream('another').from(event.event_id).result).to_a
1063
+ end.to raise_error(RubyEventStore::EventNotFound, "Event not found: #{event.event_id}")
1064
+ end
1065
+
1066
+ specify do
1067
+ event = SRecord.new
1068
+ repository.append_to_stream([event], Stream.new('dummy'), ExpectedVersion.any)
1069
+ expect do
1070
+ repository.read(specification.stream('another').to(event.event_id).result).to_a
1071
+ end.to raise_error(RubyEventStore::EventNotFound, "Event not found: #{event.event_id}")
1072
+ end
1073
+
1074
+ specify do
1075
+ not_existing_uuid = SecureRandom.uuid
1076
+ expect do
1077
+ repository.read(specification.from(not_existing_uuid).result).to_a
1078
+ end.to raise_error(RubyEventStore::EventNotFound, "Event not found: #{not_existing_uuid}")
1079
+ end
1080
+
1081
+ specify do
1082
+ not_existing_uuid = SecureRandom.uuid
1083
+ expect do
1084
+ repository.read(specification.to(not_existing_uuid).result).to_a
1085
+ end.to raise_error(RubyEventStore::EventNotFound, "Event not found: #{not_existing_uuid}")
1086
+ end
1087
+
1058
1088
  context "#update_messages" do
1059
1089
  specify "changes events" do
1060
1090
  skip unless helper.supports_upsert?
@@ -28,7 +28,6 @@ module RubyEventStore
28
28
  # @return [Specification]
29
29
  def from(start)
30
30
  raise InvalidPageStart if start.nil? || start.empty?
31
- raise EventNotFound.new(start) unless reader.has_event?(start)
32
31
  Specification.new(reader, result.dup { |r| r.start = start })
33
32
  end
34
33
 
@@ -39,7 +38,6 @@ module RubyEventStore
39
38
  # @return [Specification]
40
39
  def to(stop)
41
40
  raise InvalidPageStop if stop.nil? || stop.empty?
42
- raise EventNotFound.new(stop) unless reader.has_event?(stop)
43
41
  Specification.new(reader, result.dup { |r| r.stop = stop })
44
42
  end
45
43
 
@@ -29,12 +29,6 @@ module RubyEventStore
29
29
  repository.count(specification_result)
30
30
  end
31
31
 
32
- # @api private
33
- # @private
34
- def has_event?(event_id)
35
- repository.has_event?(event_id)
36
- end
37
-
38
32
  private
39
33
 
40
34
  attr_reader :repository, :mapper
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyEventStore
4
- VERSION = "2.11.1"
4
+ VERSION = "2.12.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_event_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.1
4
+ version: 2.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-24 00:00:00.000000000 Z
11
+ date: 2023-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby