ruby_event_store 2.11.0 → 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: a13012b6cc672274f7818f51f777a864dd52e301023bdb2892a83adda5805550
4
- data.tar.gz: 6f00d31f07180e67e20abe178d30f9f38606e813bc8ccf69c5f327687d6fb067
3
+ metadata.gz: 340c04c1b68fa8cebc285043301c1f4f18a3991f3b8907902867fa8ea58fba1e
4
+ data.tar.gz: 5f2e265af27f9d41aa973f7330269ed8364e59d598a944a1727d2e586e23760b
5
5
  SHA512:
6
- metadata.gz: a42330d20f5a09086428f5f83ea14383020ae027fa9ebaf36688e98e86a93f28808a214d384dbd3ee99d433027be42ac2556be9b7341b745f6b1e3b3ee4e7f9c
7
- data.tar.gz: 421b823b296a89afc6f224ea340187520d48b762c412f9583172a0c89bc28822a9476bb418bc7f0fd5cc7ddada03360546c6293c8e53146e31d7debc97e193a7
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.0"
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.0
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-20 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
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
- rubygems_version: 3.4.10
122
+ rubygems_version: 3.4.17
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Implementation of an event store in Ruby