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 +4 -4
- data/lib/ruby_event_store/in_memory_repository.rb +4 -1
- data/lib/ruby_event_store/spec/event_repository_lint.rb +31 -1
- data/lib/ruby_event_store/specification.rb +0 -2
- data/lib/ruby_event_store/specification_reader.rb +0 -6
- data/lib/ruby_event_store/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 340c04c1b68fa8cebc285043301c1f4f18a3991f3b8907902867fa8ea58fba1e
|
4
|
+
data.tar.gz: 5f2e265af27f9d41aa973f7330269ed8364e59d598a944a1727d2e586e23760b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
|
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.
|
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-
|
11
|
+
date: 2023-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|