entity_store_sequel 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0c310ad09d9b4c46c37e3c65753c468f320b6173
|
|
4
|
+
data.tar.gz: aa05911221ca3d090312bc1f1a2db571e15292fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a209d82e693a10f10a902fbfbd6d181db7097b83917d0b262fa610220156680d464a83a036470f5b92711830a6af2c5833b02e0fcc451ed9a014507e0f00c63b
|
|
7
|
+
data.tar.gz: aacc583d939547bb89377be02c27dead10946aebe0c7fdd0d40931d33e6997eb042f73405ac6d41ecc95f1a6df08ae07e14df59f1670c4ca6c34f85f75e3c399
|
|
@@ -200,9 +200,9 @@ module EntityStoreSequel
|
|
|
200
200
|
criteria.each_with_index do |item, i|
|
|
201
201
|
filter_method = filter_method_name(i)
|
|
202
202
|
if item[:since_version]
|
|
203
|
-
query = query.send(filter_method, '_entity_id = ? AND entity_version > ?', item[:id], item[:since_version])
|
|
203
|
+
query = query.send(filter_method, Sequel.lit('_entity_id = ? AND entity_version > ?', item[:id], item[:since_version]))
|
|
204
204
|
else
|
|
205
|
-
query = query.send(filter_method, '_entity_id = ?', item[:id])
|
|
205
|
+
query = query.send(filter_method, Sequel.lit('_entity_id = ?', item[:id]))
|
|
206
206
|
end
|
|
207
207
|
end
|
|
208
208
|
|
|
@@ -75,11 +75,11 @@ describe PostgresEntityStore do
|
|
|
75
75
|
let(:since_version) { 0 }
|
|
76
76
|
|
|
77
77
|
it "should return the four events in order for known id" do
|
|
78
|
-
subject[event_entity_id].
|
|
78
|
+
expect(subject[event_entity_id]).to eq [first_event, second_event, third_event, fourth_event]
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
it "should return no events in order unknown id" do
|
|
82
|
-
subject[unknown_id].
|
|
82
|
+
expect(subject[unknown_id]).to be_empty
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
85
|
end
|
|
@@ -91,7 +91,7 @@ describe PostgresEntityStore do
|
|
|
91
91
|
let(:since_version) { 0 }
|
|
92
92
|
|
|
93
93
|
it "should return the four events in order" do
|
|
94
|
-
subject.
|
|
94
|
+
expect(subject).to eq [first_event, second_event, third_event, fourth_event]
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
97
|
|
|
@@ -100,7 +100,7 @@ describe PostgresEntityStore do
|
|
|
100
100
|
let(:since_version) { second_event.entity_version }
|
|
101
101
|
|
|
102
102
|
it "should only include events greater than the given version" do
|
|
103
|
-
subject.
|
|
103
|
+
expect(subject).to eq [ fourth_event ]
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
|
|
@@ -109,7 +109,7 @@ describe PostgresEntityStore do
|
|
|
109
109
|
let(:since_version) { 0 }
|
|
110
110
|
|
|
111
111
|
it "should return an empty array" do
|
|
112
|
-
subject.
|
|
112
|
+
expect(subject).to be_empty
|
|
113
113
|
end
|
|
114
114
|
end
|
|
115
115
|
end
|
|
@@ -137,28 +137,28 @@ describe PostgresEntityStore do
|
|
|
137
137
|
subject { store.get_entities( [ id ], options) }
|
|
138
138
|
|
|
139
139
|
it "should retrieve an entity from the store with the same ID" do
|
|
140
|
-
subject.first.id.
|
|
140
|
+
expect(subject.first.id).to eq saved_entity.id
|
|
141
141
|
end
|
|
142
142
|
|
|
143
143
|
it "should retrieve an entity from the store with the same class" do
|
|
144
|
-
subject.first.class.
|
|
144
|
+
expect(subject.first.class).to eq saved_entity.class
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
it "should have the same version" do
|
|
148
|
-
subject.first.version.
|
|
148
|
+
expect(subject.first.version).to eq saved_entity.version
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
context "when a snapshot does not exist" do
|
|
152
152
|
it "should not have set the name" do
|
|
153
|
-
subject.first.name.
|
|
153
|
+
expect(subject.first.name).to be_nil
|
|
154
154
|
end
|
|
155
155
|
|
|
156
156
|
it "should not have a date set" do
|
|
157
|
-
subject.first.date.
|
|
157
|
+
expect(subject.first.date).to be_nil
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
it "should not have a symbol set" do
|
|
161
|
-
subject.first.symbol.
|
|
161
|
+
expect(subject.first.symbol).to be_nil
|
|
162
162
|
end
|
|
163
163
|
end
|
|
164
164
|
|
|
@@ -170,20 +170,20 @@ describe PostgresEntityStore do
|
|
|
170
170
|
|
|
171
171
|
context "when a snapshot key not in use" do
|
|
172
172
|
it "should have set the name" do
|
|
173
|
-
subject.first.name.
|
|
173
|
+
expect(subject.first.name).to eq saved_entity.name
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
it "should have a date set" do
|
|
177
|
-
subject.first.date.
|
|
177
|
+
expect(subject.first.date).to eq saved_entity.date
|
|
178
178
|
end
|
|
179
179
|
|
|
180
180
|
it "should have a symbol set" do
|
|
181
|
-
subject.first.symbol.
|
|
181
|
+
expect(subject.first.symbol).to eq :foo
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
it "should have a symbol hash set" do
|
|
185
|
-
subject.first.symbol_hash.
|
|
186
|
-
subject.first.nested_hash.
|
|
185
|
+
expect(subject.first.symbol_hash).to eq ({ "foo" => :bar })
|
|
186
|
+
expect(subject.first.nested_hash).to eq ({ "foo" => { "bar" => :baz } })
|
|
187
187
|
end
|
|
188
188
|
end
|
|
189
189
|
|
|
@@ -192,7 +192,7 @@ describe PostgresEntityStore do
|
|
|
192
192
|
|
|
193
193
|
context "when the key matches the class's key" do
|
|
194
194
|
it "should have set the name" do
|
|
195
|
-
subject.first.name.
|
|
195
|
+
expect(subject.first.name).to eq saved_entity.name
|
|
196
196
|
end
|
|
197
197
|
end
|
|
198
198
|
|
|
@@ -202,7 +202,7 @@ describe PostgresEntityStore do
|
|
|
202
202
|
end
|
|
203
203
|
|
|
204
204
|
it "should ignore the invalidated snapshot" do
|
|
205
|
-
subject.first.name.
|
|
205
|
+
expect(subject.first.name).to be_nil
|
|
206
206
|
end
|
|
207
207
|
end
|
|
208
208
|
end
|
|
@@ -242,10 +242,10 @@ describe PostgresEntityStore do
|
|
|
242
242
|
it "should add a snaphot to the entity record" do
|
|
243
243
|
subject
|
|
244
244
|
|
|
245
|
-
snapshot['id'].
|
|
246
|
-
snapshot['version'].
|
|
247
|
-
snapshot['name'].
|
|
248
|
-
snapshot['description'].
|
|
245
|
+
expect(snapshot['id']).to eq(entity.id)
|
|
246
|
+
expect(snapshot['version']).to eq(entity.version)
|
|
247
|
+
expect(snapshot['name']).to eq(entity.name)
|
|
248
|
+
expect(snapshot['description']).to eq(entity.description)
|
|
249
249
|
end
|
|
250
250
|
|
|
251
251
|
context "entity with snapshot key" do
|
|
@@ -253,7 +253,7 @@ describe PostgresEntityStore do
|
|
|
253
253
|
|
|
254
254
|
it "should store the snapshot key" do
|
|
255
255
|
subject
|
|
256
|
-
saved_entity[:snapshot_key].
|
|
256
|
+
expect(saved_entity[:snapshot_key]).to eq entity.class.entity_store_snapshot_key
|
|
257
257
|
end
|
|
258
258
|
end
|
|
259
259
|
end
|
data/spec/entity_store_spec.rb
CHANGED
|
@@ -50,10 +50,10 @@ describe "end to end" do
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
it "publishes event to the subscriber" do
|
|
53
|
-
DummyEntitySubscriber.event_name.
|
|
53
|
+
expect(DummyEntitySubscriber.event_name).to eq(name)
|
|
54
54
|
end
|
|
55
55
|
it "is retrievable with the events applied" do
|
|
56
|
-
EntityStore::Store.new.get(@entity.id).name.
|
|
56
|
+
expect(EntityStore::Store.new.get(@entity.id).name).to eq(name)
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -78,10 +78,10 @@ describe "setting connection from existing" do
|
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
it "publishes event to the subscriber" do
|
|
81
|
-
DummyEntitySubscriber.event_name.
|
|
81
|
+
expect(DummyEntitySubscriber.event_name).to eq(name)
|
|
82
82
|
end
|
|
83
83
|
it "is retrievable with the events applied" do
|
|
84
|
-
EntityStore::Store.new.get(@entity.id).name.
|
|
84
|
+
expect(EntityStore::Store.new.get(@entity.id).name).to eq(name)
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: entity_store_sequel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stephen Binns
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-12-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: sequel
|
|
@@ -117,11 +117,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
117
117
|
version: '0'
|
|
118
118
|
requirements: []
|
|
119
119
|
rubyforge_project:
|
|
120
|
-
rubygems_version: 2.6.
|
|
120
|
+
rubygems_version: 2.6.12
|
|
121
121
|
signing_key:
|
|
122
122
|
specification_version: 4
|
|
123
123
|
summary: Sequel body for Entity Store
|
|
124
124
|
test_files:
|
|
125
|
-
- spec/entity_store_sequel/postgres_entity_store_spec.rb
|
|
126
|
-
- spec/entity_store_spec.rb
|
|
127
125
|
- spec/spec_helper.rb
|
|
126
|
+
- spec/entity_store_spec.rb
|
|
127
|
+
- spec/entity_store_sequel/postgres_entity_store_spec.rb
|