nexia_event_store 0.7.1 → 0.7.2

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
  SHA1:
3
- metadata.gz: ed9c68785a9f1b0296f4c1e94ead1798ade28b78
4
- data.tar.gz: 788425c810902f02ec04fbda939811d76b355df7
3
+ metadata.gz: a99ede0e343cb9afe0641ccf0f97b6ede6d94c1d
4
+ data.tar.gz: 356728b39664676f69f18b719efdf1bb3561d865
5
5
  SHA512:
6
- metadata.gz: b1d32f2725fb28f16f0ffa01042ff663cb6372e67cc714e2a61c710c02c403d47cbeedf044b740940c035195e82c5c1a958033a73abf6e8864fed82b72550a50
7
- data.tar.gz: 527085c3a109100a638350c21d367052582ec2e0a80f92cd422156069a46baa7ef81e34dcfd1dec25475e903825830281f61bc2f52ce5bc359bf8ca6361bf9db
6
+ metadata.gz: 4638a89824d357ff595cf365cb675cd3f9fc11caf30fadeb10b25e5079a6ca510837fa67a92d3f75e19688fdaec53db7c3ff914e426c224a8718168d6b12b8f2
7
+ data.tar.gz: 81ccbaa007f95d930d9b00e94924a77a5c2517c8c13ff63629052c74329c20254d02002f8a5f9182aaf35833b3a11b2333689887751444618c5b3be5f8c9a795
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
  # Specify your gem's dependencies in event_store_gem.gemspec
3
3
  gemspec
data/Guardfile CHANGED
@@ -1,6 +1,5 @@
1
-
2
- guard 'rspec' do
1
+ guard "rspec", cmd: "rspec", notification: false do
3
2
  watch(%r{^spec/.+_spec\.rb$})
4
3
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
5
- watch('spec/spec_helper.rb') { "spec" }
4
+ watch("spec/spec_helper.rb") { "spec" }
6
5
  end
data/Rakefile CHANGED
@@ -4,11 +4,6 @@ RSpec::Core::RakeTask.new(:'spec:ci')
4
4
 
5
5
  task :default => :'spec:ci'
6
6
 
7
- def rspec_out_file
8
- require 'rspec_junit_formatter'
9
- "-f RspecJunitFormatter -o results.xml"
10
- end
11
-
12
7
  desc "Seed the performance db with millions of events"
13
8
  task :'db:seed:perf' do
14
9
  sh 'time bundle exec ruby spec/benchmark/seed_db.rb'
@@ -19,16 +14,11 @@ task :benchmark do
19
14
  sh 'bundle exec ruby spec/benchmark/bench.rb'
20
15
  end
21
16
 
22
- desc "Run all tests and generate coverage xml"
23
- task :'spec:cov' do
24
- sh "bundle exec rspec #{rspec_out_file} spec"
25
- end
26
-
27
17
  desc "migrate db"
28
18
  task :'db:migrate' do
29
19
  begin
30
20
  sh 'createdb history_store'
31
- rescue => e
21
+ rescue
32
22
  #we don't care if it exists already, so don't fail
33
23
  end
34
24
  sh 'psql history_store < db/setup_db_user.sql'
data/event_store.gemspec CHANGED
@@ -1,36 +1,33 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'event_store/version'
4
+ require "event_store/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = 'nexia_event_store'
7
+ spec.name = "nexia_event_store"
8
8
  spec.version = EventStore::VERSION
9
- spec.authors = ['Paul Saieg, John Colvin', 'Stuart Nelson']
10
- spec.description = ['A Ruby implementation of an EventSource (A+ES) tuned for Vertica or Postgres']
11
- spec.email = ['classicist@gmail.com, jgeiger@gmail.com']
9
+ spec.authors = ["Paul Saieg, John Colvin", "Stuart Nelson"]
10
+ spec.description = ["A Ruby implementation of an EventSource (A+ES) tuned for Vertica or Postgres"]
11
+ spec.email = ["classicist@gmail.com, jgeiger@gmail.com"]
12
12
  spec.summary = %q{Ruby implementation of an EventSource (A+ES) for the Nexia Ecosystem}
13
- spec.homepage = 'https://github.com/nexiahome/event_store'
14
- spec.license = 'MIT'
13
+ spec.homepage = "https://github.com/nexiahome/event_store"
14
+ spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ['lib']
19
+ spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency 'bundler', '~> 1.7'
22
- spec.add_development_dependency 'rake', '~> 0'
23
- spec.add_development_dependency 'rspec', '~> 3.1'
24
- spec.add_development_dependency 'simplecov', '~> 0.9'
25
- spec.add_development_dependency 'simplecov-rcov', '~> 0.2'
26
- spec.add_development_dependency 'guard-rspec', '~> 4.3'
27
- spec.add_development_dependency 'pry-byebug', '~> 2.0'
28
- spec.add_development_dependency 'mock_redis', '~> 0.13'
21
+ spec.add_development_dependency "bundler", "~> 1.9"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.2"
24
+ spec.add_development_dependency "guard-rspec", "~> 4.5"
25
+ spec.add_development_dependency "byebug", "~> 5.0"
26
+ spec.add_development_dependency "mock_redis", "~> 0.13"
29
27
 
30
- spec.add_dependency 'sequel', '~> 4.14'
31
- spec.add_dependency 'sequel-vertica', '~> 0.2'
32
- spec.add_dependency 'pg', '~> 0.17'
33
- spec.add_dependency 'redis', '~> 3.1'
34
- spec.add_dependency 'hiredis', '~> 0.5'
35
- spec.add_development_dependency 'rspec_junit_formatter', '~> 0.2'
28
+ spec.add_dependency "sequel", "~> 4.14"
29
+ spec.add_dependency "sequel-vertica", "~> 0.2"
30
+ spec.add_dependency "pg", "~> 0.17"
31
+ spec.add_dependency "redis", "~> 3.1"
32
+ spec.add_dependency "hiredis", "~> 0.5"
36
33
  end
@@ -62,7 +62,7 @@ module EventStore
62
62
 
63
63
  rows = fully_qualified_names.inject([]) { |memo, name|
64
64
  memo + events.where(fully_qualified_name: name).where{ occurred_at < timestampz }
65
- .reverse_order(:occurred_at).limit(1).all
65
+ .reverse_order(:occurred_at, :id).limit(1).all
66
66
  }.sort_by { |r| r[:occurred_at] }
67
67
 
68
68
  rows.map {|r| r[:serialized_event] = EventStore.unescape_bytea(r[:serialized_event]); r}
@@ -1,3 +1,3 @@
1
1
  module EventStore
2
- VERSION = '0.7.1'
2
+ VERSION = '0.7.2'
3
3
  end
@@ -1,5 +1,5 @@
1
- require 'spec_helper'
2
- require 'securerandom'
1
+ require "spec_helper"
2
+ require "securerandom"
3
3
 
4
4
  AGGREGATE_ID_ONE = SecureRandom.uuid
5
5
  AGGREGATE_ID_TWO = SecureRandom.uuid
@@ -47,7 +47,7 @@ describe EventStore::Client do
47
47
  end
48
48
  end
49
49
 
50
- describe '#raw_event_stream' do
50
+ describe "#raw_event_stream" do
51
51
  it "should be an array of hashes that represent database records, not EventStore::SerializedEvent objects" do
52
52
  raw_stream = es_client.new(AGGREGATE_ID_ONE, :device).raw_event_stream
53
53
  raw_event = raw_stream.first
@@ -55,23 +55,23 @@ describe EventStore::Client do
55
55
  expect(raw_event.keys.to_set).to eq(Set.new([:id, :version, :aggregate_id, :fully_qualified_name, :fully_qualified_name_id, :occurred_at, :serialized_event, :sub_key]))
56
56
  end
57
57
 
58
- it 'should be empty for aggregates without events' do
58
+ it "should be empty for aggregates without events" do
59
59
  stream = es_client.new(100, :device).raw_event_stream
60
60
  expect(stream.empty?).to be_truthy
61
61
  end
62
62
 
63
- it 'should only have events for a single aggregate' do
63
+ it "should only have events for a single aggregate" do
64
64
  stream = es_client.new(AGGREGATE_ID_ONE, :device).raw_event_stream
65
65
  stream.each { |event| expect(event[:aggregate_id]).to eq(AGGREGATE_ID_ONE) }
66
66
  end
67
67
 
68
- it 'should have all events for that aggregate' do
68
+ it "should have all events for that aggregate" do
69
69
  stream = es_client.new(AGGREGATE_ID_ONE, :device).raw_event_stream
70
70
  expect(stream.count).to eq(15)
71
71
  end
72
72
  end
73
73
 
74
- describe '#event_stream' do
74
+ describe "#event_stream" do
75
75
  it "should be an array of EventStore::SerializedEvent objects" do
76
76
  stream = es_client.new(AGGREGATE_ID_ONE, :device).event_stream
77
77
  expect(stream.class).to eq(Array)
@@ -79,18 +79,18 @@ describe EventStore::Client do
79
79
  expect(event.class).to eq(EventStore::SerializedEvent)
80
80
  end
81
81
 
82
- it 'should be empty for aggregates without events' do
82
+ it "should be empty for aggregates without events" do
83
83
  stream = es_client.new(100, :device).raw_event_stream
84
84
  expect(stream.empty?).to be_truthy
85
85
  end
86
86
 
87
- it 'should only have events for a single aggregate' do
87
+ it "should only have events for a single aggregate" do
88
88
  raw_stream = es_client.new(AGGREGATE_ID_ONE, :device).raw_event_stream
89
89
  stream = es_client.new(AGGREGATE_ID_ONE, :device).event_stream
90
90
  expect(stream.map(&:fully_qualified_name)).to eq(raw_stream.inject([]){|m, event| m << event[:fully_qualified_name]; m})
91
91
  end
92
92
 
93
- it 'should have all events for that aggregate' do
93
+ it "should have all events for that aggregate" do
94
94
  stream = es_client.new(AGGREGATE_ID_ONE, :device).event_stream
95
95
  expect(stream.count).to eq(15)
96
96
  end
@@ -99,7 +99,7 @@ describe EventStore::Client do
99
99
  it "does not truncate the serialized event when there is a binary zero value is at the end" do
100
100
  serialized_event = serialized_event_data_terminated_by_null
101
101
  client = es_client.new("any_device", :device)
102
- event = EventStore::Event.new("any_device", @event_time, 'other_event_name', "nozone", serialized_event)
102
+ event = EventStore::Event.new("any_device", @event_time, "other_event_name", "nozone", serialized_event)
103
103
  client.append([event])
104
104
  expect(client.event_stream.last[:serialized_event]).to eql(serialized_event)
105
105
  end
@@ -107,7 +107,7 @@ describe EventStore::Client do
107
107
  it "conversion of byte array to and from hex should be lossless" do
108
108
  client = es_client.new("any_device", :device)
109
109
  serialized_event = serialized_event_data_terminated_by_null
110
- event = EventStore::Event.new("any_device", @event_time, 'terminated_by_null_event', "zone_number", serialized_event)
110
+ event = EventStore::Event.new("any_device", @event_time, "terminated_by_null_event", "zone_number", serialized_event)
111
111
  retval = client.append([event])
112
112
  hex_from_db = EventStore.db.from(EventStore.fully_qualified_table).order(:id).last[:serialized_event]
113
113
 
@@ -116,54 +116,54 @@ describe EventStore::Client do
116
116
  end
117
117
  end
118
118
 
119
- describe '#raw_event_streams_from_event_id' do
119
+ describe "#raw_event_streams_from_event_id" do
120
120
  subject { es_client.new(AGGREGATE_ID_ONE, :device) }
121
121
  let(:raw_stream) { subject.raw_event_stream }
122
122
  let(:minimum_event_id) { raw_stream.events.all[1][:id] }
123
123
  let(:events_from) { subject.raw_event_stream_from(minimum_event_id) }
124
124
 
125
- it 'should return all the raw events in the stream starting from a certain event_id' do
125
+ it "should return all the raw events in the stream starting from a certain event_id" do
126
126
  event_ids = events_from.inject([]){|m, event| m << event[:id]; m}
127
127
  expect(event_ids.min).to be >= minimum_event_id
128
128
  end
129
129
 
130
- it 'should return no more than the maximum number of events specified above the ' do
130
+ it "should return no more than the maximum number of events specified above the " do
131
131
  max_number_of_events = 5
132
132
  minimum_event_id = 2
133
133
  raw_stream = subject.raw_event_stream_from(minimum_event_id, max_number_of_events)
134
134
  expect(raw_stream.count).to eq(max_number_of_events)
135
135
  end
136
136
 
137
- it 'should be empty for version above the current highest version number' do
137
+ it "should be empty for version above the current highest version number" do
138
138
  raw_stream = subject.raw_event_stream_from(subject.event_id + 1)
139
139
  expect(raw_stream).to be_empty
140
140
  end
141
141
  end
142
142
 
143
- describe 'event_stream_from_event_id' do
143
+ describe "event_stream_from_event_id" do
144
144
  subject { es_client.new(AGGREGATE_ID_ONE, :device) }
145
145
 
146
- it 'should return all the raw events in the stream starting from a certain event_id' do
146
+ it "should return all the raw events in the stream starting from a certain event_id" do
147
147
  minimum_event_id = 2
148
148
  raw_stream = subject.raw_event_stream_from(minimum_event_id)
149
149
  event_ids = raw_stream.inject([]){|m, event| m << event[:id]; m}
150
150
  expect(event_ids.min).to be >= minimum_event_id
151
151
  end
152
152
 
153
- it 'should return no more than the maximum number of events specified above the ' do
153
+ it "should return no more than the maximum number of events specified above the " do
154
154
  max_number_of_events = 5
155
155
  minimum_event_id = 2
156
156
  raw_stream = subject.raw_event_stream_from(minimum_event_id, max_number_of_events)
157
157
  expect(raw_stream.count).to eq(max_number_of_events)
158
158
  end
159
159
 
160
- it 'should be empty for event_id above the current highest event id' do
160
+ it "should be empty for event_id above the current highest event id" do
161
161
  raw_stream = subject.raw_event_stream_from(subject.event_id + 1)
162
162
  expect(raw_stream).to eq([])
163
163
  end
164
164
  end
165
165
 
166
- describe '#event_stream_between' do
166
+ describe "#event_stream_between" do
167
167
  subject {es_client.new(AGGREGATE_ID_ONE, :device)}
168
168
 
169
169
  before do
@@ -213,36 +213,36 @@ describe EventStore::Client do
213
213
  it "returns types requested within the time range" do
214
214
  start_time = @oldest_event_time
215
215
  end_time = @newest_event_time
216
- fully_qualified_name = 'middle_event'
216
+ fully_qualified_name = "middle_event"
217
217
  expect(subject.event_stream_between(start_time, end_time, [fully_qualified_name]).length).to eq(1)
218
218
  end
219
219
 
220
220
  it "returns types requested within the time range for more than one type" do
221
221
  start_time = @oldest_event_time
222
222
  end_time = @newest_event_time
223
- fully_qualified_names = ['middle_event', 'newest_event_type']
223
+ fully_qualified_names = ["middle_event", "newest_event_type"]
224
224
  expect(subject.event_stream_between(start_time, end_time, fully_qualified_names).length).to eq(2)
225
225
  end
226
226
 
227
227
  it "returns an empty array if there are no events of the requested types in the time range" do
228
228
  start_time = @oldest_event_time
229
229
  end_time = @newest_event_time
230
- fully_qualified_names = ['random_strings']
230
+ fully_qualified_names = ["random_strings"]
231
231
  expect(subject.event_stream_between(start_time, end_time, fully_qualified_names).length).to eq(0)
232
232
  end
233
233
 
234
234
  it "returns only events of types that exist within the time range" do
235
235
  start_time = @oldest_event_time
236
236
  end_time = @newest_event_time
237
- fully_qualified_names = ['middle_event', 'event_name']
237
+ fully_qualified_names = ["middle_event", "event_name"]
238
238
  expect(subject.event_stream_between(start_time, end_time, fully_qualified_names).length).to eq(1)
239
239
  end
240
240
  end
241
241
 
242
- describe '#peek' do
242
+ describe "#peek" do
243
243
  let(:client) { es_client.new(AGGREGATE_ID_ONE, :device) }
244
244
 
245
- it 'should return the last event in the event stream' do
245
+ it "should return the last event in the event stream" do
246
246
  last_event = client.raw_event_stream.last
247
247
  peek = client.peek
248
248
  expect(peek.fully_qualified_name).to eq(last_event[:fully_qualified_name])
@@ -254,7 +254,7 @@ describe EventStore::Client do
254
254
  context "with prescribed events" do
255
255
  let(:event_time) { Time.now }
256
256
 
257
- describe '#append' do
257
+ describe "#append" do
258
258
  let(:client) { EventStore::Client.new(AGGREGATE_ID_ONE, :device) }
259
259
  let(:old_event) { EventStore::Event.new(AGGREGATE_ID_ONE, (event_time - 2000).utc, "old", "zone", "#{1000.to_s(2)}_foo") }
260
260
  let(:new_event) { EventStore::Event.new(AGGREGATE_ID_ONE, (event_time - 1000).utc, "new", "zone", "#{1001.to_s(2)}_foo") }
@@ -262,19 +262,19 @@ describe EventStore::Client do
262
262
  let(:duplicate_event) { EventStore::Event.new(AGGREGATE_ID_ONE, (event_time).utc, "duplicate", "zone", "#{12.to_s(2)}_foo") }
263
263
 
264
264
  describe "when expected event id is greater than the last event id" do
265
- describe 'and there are no prior events of type' do
265
+ describe "and there are no prior events of type" do
266
266
  before(:each) do
267
267
  client.append([old_event])
268
268
  end
269
269
 
270
- it 'should append a single event of a new type without raising an error' do
270
+ it "should append a single event of a new type without raising an error" do
271
271
  initial_count = client.count
272
272
  events = [new_event]
273
273
  client.append(events)
274
274
  expect(client.count).to eq(initial_count + events.length)
275
275
  end
276
276
 
277
- it 'should append multiple events of a new type without raising and error' do
277
+ it "should append multiple events of a new type without raising and error" do
278
278
  initial_count = client.count
279
279
  events = [new_event, new_event]
280
280
  client.append(events)
@@ -307,12 +307,12 @@ describe EventStore::Client do
307
307
  end
308
308
  end
309
309
 
310
- describe 'with prior events of same type' do
310
+ describe "with prior events of same type" do
311
311
  before(:each) do
312
312
  client.append([old_event])
313
313
  end
314
314
 
315
- it 'should not raise an error when two events of the same type are appended' do
315
+ it "should not raise an error when two events of the same type are appended" do
316
316
  client.append([duplicate_event])
317
317
  client.append([duplicate_event]) #will fail automatically if it throws an error, no need for assertions (which now print warning for some reason)
318
318
  end
@@ -335,31 +335,31 @@ describe EventStore::Client do
335
335
  end
336
336
  end
337
337
 
338
- describe 'transactional' do
338
+ describe "transactional" do
339
339
  before do
340
340
  @bad_event = new_event.dup
341
341
  @bad_event.fully_qualified_name = nil
342
342
  end
343
343
 
344
- it 'should revert all append events if one fails' do
344
+ it "should revert all append events if one fails" do
345
345
  starting_count = client.count
346
346
  expect { client.append([new_event, @bad_event]) }.to raise_error(EventStore::AttributeMissingError)
347
347
  expect(client.count).to eq(starting_count)
348
348
  end
349
349
 
350
- it 'does not yield to the block if it fails' do
350
+ it "does not yield to the block if it fails" do
351
351
  x = 0
352
352
  expect { client.append([@bad_event]) { x += 1 } }.to raise_error(EventStore::AttributeMissingError)
353
353
  expect(x).to eq(0)
354
354
  end
355
355
 
356
- it 'yield to the block after event creation' do
356
+ it "yield to the block after event creation" do
357
357
  x = 0
358
358
  client.append([]) { x += 1 }
359
359
  expect(x).to eq(1)
360
360
  end
361
361
 
362
- it 'should pass the raw event_data to the block' do
362
+ it "should pass the raw event_data to the block" do
363
363
  client.append([new_event]) do |raw_event_data|
364
364
  expect(raw_event_data).to eq([new_event])
365
365
  end
@@ -367,36 +367,52 @@ describe EventStore::Client do
367
367
  end
368
368
  end
369
369
 
370
- describe '#last_event_before' do
370
+ describe "#last_event_before" do
371
+ let(:serialized_event) { "#{1002.to_s(2)}_foo" }
372
+ let(:serialized_event2) { "#{1002.to_s(2)}_foo2" }
371
373
  let(:oldest_event_time) { event_time + 1 }
372
374
  let(:middle_event_time) { event_time + 2 }
373
375
  let(:newest_event_time) { event_time + 3 }
374
- let(:other_event) { EventStore::Event.new(AGGREGATE_ID_ONE, (event_time).utc, "fqn2", "other", "#{1002.to_s(2)}_foo") }
375
- let(:event) { EventStore::Event.new(AGGREGATE_ID_ONE, (oldest_event_time).utc, "fqn1", "event", "#{1002.to_s(2)}_foo") }
376
- let(:new_event) { EventStore::Event.new(AGGREGATE_ID_ONE, (middle_event_time).utc, "fqn1", "new", "#{1002.to_s(2)}_foo") }
377
- let(:newest_event) { EventStore::Event.new(AGGREGATE_ID_ONE, (newest_event_time).utc, "fqn1", "newest", "#{1002.to_s(2)}_foo") }
376
+ let(:other_event) { EventStore::Event.new(AGGREGATE_ID_ONE, (event_time).utc, "fqn2", "other", serialized_event) }
377
+ let(:another_event) { EventStore::Event.new(AGGREGATE_ID_ONE, (event_time).utc, "fqn2", "another", serialized_event2) }
378
+ let(:event) { EventStore::Event.new(AGGREGATE_ID_ONE, (oldest_event_time).utc, "fqn1", "event", serialized_event) }
379
+ let(:new_event) { EventStore::Event.new(AGGREGATE_ID_ONE, (middle_event_time).utc, "fqn1", "new", serialized_event) }
380
+ let(:newest_event) { EventStore::Event.new(AGGREGATE_ID_ONE, (newest_event_time).utc, "fqn1", "newest", serialized_event) }
378
381
  let(:fqns) { %W(fqn1 fqn2) }
382
+ let(:events) { [other_event, event, new_event, newest_event] }
383
+
379
384
 
380
385
  subject(:client) { es_client.new(AGGREGATE_ID_ONE, :device) }
381
386
 
382
387
  before do
383
- client.append([other_event, event, new_event, newest_event])
388
+ client.append(events)
384
389
  end
385
390
 
386
391
  it "returns the latest event before the given time" do
387
392
  last_events = client.last_event_before(newest_event_time, fqns)
388
393
  expect(last_events.map{ |e| e.occurred_at.to_i}).to eq([other_event[:occurred_at].to_i, new_event[:occurred_at].to_i])
389
394
  end
395
+
396
+ context "with two prior events at the same time" do
397
+ let(:events) { [other_event, another_event, event, new_event, newest_event] }
398
+ let(:fqns) { %W(fqn2) }
399
+
400
+ it "returns the event with the largest id" do
401
+ last_events = client.last_event_before(event_time + 1, fqns)
402
+
403
+ expect(last_events.last.serialized_event).to eq(serialized_event2)
404
+ end
405
+ end
390
406
  end
391
407
  end
392
408
 
393
409
  def serialized_event_data_terminated_by_null
394
- @term_data ||= File.open(File.expand_path("../binary_string_term_with_null_byte.txt", __FILE__), 'rb') {|f| f.read}
410
+ @term_data ||= File.open(File.expand_path("../binary_string_term_with_null_byte.txt", __FILE__), "rb") {|f| f.read}
395
411
  @term_data
396
412
  end
397
413
 
398
414
  def serialized_binary_event_data
399
- @event_data ||= File.open(File.expand_path("../serialized_binary_event_data.txt", __FILE__), 'rb') {|f| f.read}
415
+ @event_data ||= File.open(File.expand_path("../serialized_binary_event_data.txt", __FILE__), "rb") {|f| f.read}
400
416
  @event_data
401
417
  end
402
418
  end
@@ -1,8 +1,8 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe "Configuration" do
4
4
  it "should do nothing if you try to clear! without a connected db" do
5
5
  allow(EventStore).to receive(:db).and_return(nil)
6
6
  expect {EventStore.clear!}.not_to raise_error
7
7
  end
8
- end
8
+ end
@@ -1,5 +1,5 @@
1
- require 'spec_helper'
2
- require 'securerandom'
1
+ require "spec_helper"
2
+ require "securerandom"
3
3
 
4
4
  AGGREGATE_ID_ONE = SecureRandom.uuid
5
5
  AGGREGATE_ID_TWO = SecureRandom.uuid
@@ -85,7 +85,7 @@ module EventStore
85
85
  end
86
86
 
87
87
  def serialized_binary_event_data
88
- @event_data ||= File.open(File.expand_path("../serialized_binary_event_data.txt", __FILE__), 'rb') {|f| f.read}
88
+ @event_data ||= File.open(File.expand_path("../serialized_binary_event_data.txt", __FILE__), "rb") {|f| f.read}
89
89
  @event_data
90
90
  end
91
91
 
data/spec/spec_helper.rb CHANGED
@@ -1,29 +1,10 @@
1
- require 'simplecov'
2
- require 'simplecov-rcov'
3
- require 'ostruct'
4
- require 'pry'
5
- require 'pry-byebug'
6
- require 'rspec'
1
+ require "ostruct"
2
+ require "rspec"
7
3
 
8
- class SimpleCov::Formatter::MergedFormatter
9
- def format(result)
10
- SimpleCov::Formatter::HTMLFormatter.new.format(result)
11
- SimpleCov::Formatter::RcovFormatter.new.format(result)
12
- end
13
- end
14
- SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter
15
-
16
- SimpleCov.start do
17
- add_filter "/spec/"
18
- add_filter "/vendor/bundle/"
19
- add_filter 'lib/event_store.rb'
20
- SimpleCov.minimum_coverage 95
21
- end
22
-
23
- require 'event_store'
4
+ require "event_store"
24
5
 
25
6
  # connect to the test db for the gem, create to ensure exists, delete and re-create
26
- EventStore.postgres('test', 'test_events', 'event_store_gem_test')
7
+ EventStore.postgres("test", "test_events", "event_store_gem_test")
27
8
  EventStore.create_db
28
9
  EventStore.clear!
29
10
  EventStore.create_db
@@ -1,5 +1,5 @@
1
- require 'spec_helper'
2
- require 'mock_redis'
1
+ require "spec_helper"
2
+ require "mock_redis"
3
3
 
4
4
  module EventStore
5
5
  describe Aggregate do
@@ -1,5 +1,5 @@
1
- require 'spec_helper'
2
- require 'mock_redis'
1
+ require "spec_helper"
2
+ require "mock_redis"
3
3
 
4
4
  module EventStore
5
5
  describe Snapshot do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexia_event_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Saieg, John Colvin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-18 00:00:00.000000000 Z
12
+ date: 2015-06-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -17,98 +17,70 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.7'
20
+ version: '1.9'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.7'
27
+ version: '1.9'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0'
34
+ version: '10.0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0'
41
+ version: '10.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '3.1'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - "~>"
54
- - !ruby/object:Gem::Version
55
- version: '3.1'
56
- - !ruby/object:Gem::Dependency
57
- name: simplecov
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '0.9'
48
+ version: '3.2'
63
49
  type: :development
64
50
  prerelease: false
65
51
  version_requirements: !ruby/object:Gem::Requirement
66
52
  requirements:
67
53
  - - "~>"
68
54
  - !ruby/object:Gem::Version
69
- version: '0.9'
70
- - !ruby/object:Gem::Dependency
71
- name: simplecov-rcov
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '0.2'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '0.2'
55
+ version: '3.2'
84
56
  - !ruby/object:Gem::Dependency
85
57
  name: guard-rspec
86
58
  requirement: !ruby/object:Gem::Requirement
87
59
  requirements:
88
60
  - - "~>"
89
61
  - !ruby/object:Gem::Version
90
- version: '4.3'
62
+ version: '4.5'
91
63
  type: :development
92
64
  prerelease: false
93
65
  version_requirements: !ruby/object:Gem::Requirement
94
66
  requirements:
95
67
  - - "~>"
96
68
  - !ruby/object:Gem::Version
97
- version: '4.3'
69
+ version: '4.5'
98
70
  - !ruby/object:Gem::Dependency
99
- name: pry-byebug
71
+ name: byebug
100
72
  requirement: !ruby/object:Gem::Requirement
101
73
  requirements:
102
74
  - - "~>"
103
75
  - !ruby/object:Gem::Version
104
- version: '2.0'
76
+ version: '5.0'
105
77
  type: :development
106
78
  prerelease: false
107
79
  version_requirements: !ruby/object:Gem::Requirement
108
80
  requirements:
109
81
  - - "~>"
110
82
  - !ruby/object:Gem::Version
111
- version: '2.0'
83
+ version: '5.0'
112
84
  - !ruby/object:Gem::Dependency
113
85
  name: mock_redis
114
86
  requirement: !ruby/object:Gem::Requirement
@@ -193,20 +165,6 @@ dependencies:
193
165
  - - "~>"
194
166
  - !ruby/object:Gem::Version
195
167
  version: '0.5'
196
- - !ruby/object:Gem::Dependency
197
- name: rspec_junit_formatter
198
- requirement: !ruby/object:Gem::Requirement
199
- requirements:
200
- - - "~>"
201
- - !ruby/object:Gem::Version
202
- version: '0.2'
203
- type: :development
204
- prerelease: false
205
- version_requirements: !ruby/object:Gem::Requirement
206
- requirements:
207
- - - "~>"
208
- - !ruby/object:Gem::Version
209
- version: '0.2'
210
168
  description: '["A Ruby implementation of an EventSource (A+ES) tuned for Vertica or
211
169
  Postgres"]'
212
170
  email:
@@ -275,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
233
  version: '0'
276
234
  requirements: []
277
235
  rubyforge_project:
278
- rubygems_version: 2.4.3
236
+ rubygems_version: 2.4.5
279
237
  signing_key:
280
238
  specification_version: 4
281
239
  summary: Ruby implementation of an EventSource (A+ES) for the Nexia Ecosystem