ruby_event_store 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/ruby_event_store/spec/event_repository_lint.rb +21 -19
- data/lib/ruby_event_store/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 977449503b7509bf29e5ed508ecd7eee1423cc9f
|
4
|
+
data.tar.gz: 2dc475ea4234c521c9404a2a6468c1c8670289eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c64882d002f71d4608508e26c4310045da83dbf502db615d9bba52810f99ce02fb85c30423d609dab4bdbd0775efc2b6e034a3c15ee3098beca863bf0fc0ff6
|
7
|
+
data.tar.gz: 7f8743b45d31462da6074ca737f33a1dfc4805035e594d2564d9f8f15cb37fce5964afc30e8b9ba221faf9d8e827084eba883e8e009692ff2d2dfa4ccad08efe
|
data/CHANGELOG.md
CHANGED
@@ -59,25 +59,27 @@ RSpec.shared_examples :event_repository do |repository_class|
|
|
59
59
|
repository.create(TestDomainEvent.new(event_id: 'event 1'), 'stream')
|
60
60
|
repository.create(TestDomainEvent.new(event_id: 'event 2'), 'stream')
|
61
61
|
|
62
|
-
expect(repository.last_stream_event('stream')
|
62
|
+
expect(repository.last_stream_event('stream')).to eq(TestDomainEvent.new(event_id: 'event 2'))
|
63
63
|
expect(repository.last_stream_event('other_stream')).to be_nil
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'reads batch of events from stream forward & backward' do
|
67
67
|
event_ids = (1..10).to_a.map(&:to_s)
|
68
|
+
repository.create(TestDomainEvent.new(event_id: '21'), 'other_stream')
|
68
69
|
event_ids.each do |id|
|
69
70
|
repository.create(TestDomainEvent.new(event_id: id), 'stream')
|
70
71
|
end
|
72
|
+
repository.create(TestDomainEvent.new(event_id: '22'), 'other_stream')
|
71
73
|
|
72
|
-
expect(repository.read_events_forward('stream', :head, 3)
|
73
|
-
expect(repository.read_events_forward('stream', :head, 100)
|
74
|
-
expect(repository.read_events_forward('stream', '5', 4)
|
75
|
-
expect(repository.read_events_forward('stream', '5', 100)
|
74
|
+
expect(repository.read_events_forward('stream', :head, 3)).to eq ['1','2','3'].map{|x| TestDomainEvent.new(event_id: x)}
|
75
|
+
expect(repository.read_events_forward('stream', :head, 100)).to eq event_ids.map{|x| TestDomainEvent.new(event_id: x)}
|
76
|
+
expect(repository.read_events_forward('stream', '5', 4)).to eq ['6','7','8','9'].map{|x| TestDomainEvent.new(event_id: x)}
|
77
|
+
expect(repository.read_events_forward('stream', '5', 100)).to eq ['6','7','8','9','10'].map{|x| TestDomainEvent.new(event_id: x)}
|
76
78
|
|
77
|
-
expect(repository.read_events_backward('stream', :head, 3)
|
78
|
-
expect(repository.read_events_backward('stream', :head, 100)
|
79
|
-
expect(repository.read_events_backward('stream', '5', 4)
|
80
|
-
expect(repository.read_events_backward('stream', '5', 100)
|
79
|
+
expect(repository.read_events_backward('stream', :head, 3)).to eq ['10','9','8'].map{|x| TestDomainEvent.new(event_id: x)}
|
80
|
+
expect(repository.read_events_backward('stream', :head, 100)).to eq event_ids.reverse.map{|x| TestDomainEvent.new(event_id: x)}
|
81
|
+
expect(repository.read_events_backward('stream', '5', 4)).to eq ['4','3','2','1'].map{|x| TestDomainEvent.new(event_id: x)}
|
82
|
+
expect(repository.read_events_backward('stream', '5', 100)).to eq ['4','3','2','1'].map{|x| TestDomainEvent.new(event_id: x)}
|
81
83
|
end
|
82
84
|
|
83
85
|
|
@@ -88,8 +90,8 @@ RSpec.shared_examples :event_repository do |repository_class|
|
|
88
90
|
repository.create(TestDomainEvent.new(event_id: '4'), 'other_stream')
|
89
91
|
repository.create(TestDomainEvent.new(event_id: '5'), 'other_stream')
|
90
92
|
|
91
|
-
expect(repository.read_stream_events_forward('stream')
|
92
|
-
expect(repository.read_stream_events_backward('stream')
|
93
|
+
expect(repository.read_stream_events_forward('stream')).to eq ['1','3'].map{|x| TestDomainEvent.new(event_id: x)}
|
94
|
+
expect(repository.read_stream_events_backward('stream')).to eq ['3','1'].map{|x| TestDomainEvent.new(event_id: x)}
|
93
95
|
end
|
94
96
|
|
95
97
|
it 'reads batch of events from all streams forward & backward' do
|
@@ -98,14 +100,14 @@ RSpec.shared_examples :event_repository do |repository_class|
|
|
98
100
|
repository.create(TestDomainEvent.new(event_id: id), SecureRandom.uuid)
|
99
101
|
end
|
100
102
|
|
101
|
-
expect(repository.read_all_streams_forward(:head, 3)
|
102
|
-
expect(repository.read_all_streams_forward(:head, 100)
|
103
|
-
expect(repository.read_all_streams_forward('5', 4)
|
104
|
-
expect(repository.read_all_streams_forward('5', 100)
|
103
|
+
expect(repository.read_all_streams_forward(:head, 3)).to eq ['1','2','3'].map{|x| TestDomainEvent.new(event_id: x)}
|
104
|
+
expect(repository.read_all_streams_forward(:head, 100)).to eq event_ids.map{|x| TestDomainEvent.new(event_id: x)}
|
105
|
+
expect(repository.read_all_streams_forward('5', 4)).to eq ['6','7','8','9'].map{|x| TestDomainEvent.new(event_id: x)}
|
106
|
+
expect(repository.read_all_streams_forward('5', 100)).to eq ['6','7','8','9','10'].map{|x| TestDomainEvent.new(event_id: x)}
|
105
107
|
|
106
|
-
expect(repository.read_all_streams_backward(:head, 3)
|
107
|
-
expect(repository.read_all_streams_backward(:head, 100)
|
108
|
-
expect(repository.read_all_streams_backward('5', 4)
|
109
|
-
expect(repository.read_all_streams_backward('5', 100)
|
108
|
+
expect(repository.read_all_streams_backward(:head, 3)).to eq ['10','9','8'].map{|x| TestDomainEvent.new(event_id: x)}
|
109
|
+
expect(repository.read_all_streams_backward(:head, 100)).to eq event_ids.reverse.map{|x| TestDomainEvent.new(event_id: x)}
|
110
|
+
expect(repository.read_all_streams_backward('5', 4)).to eq ['4','3','2','1'].map{|x| TestDomainEvent.new(event_id: x)}
|
111
|
+
expect(repository.read_all_streams_backward('5', 100)).to eq ['4','3','2','1'].map{|x| TestDomainEvent.new(event_id: x)}
|
110
112
|
end
|
111
113
|
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: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkency
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: closed_struct
|