nexia_event_store 0.8.2 → 0.8.3

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: 7d2753973f0c45de4f539cd369f10f07813e67d2
4
- data.tar.gz: fb7678b1d8ff1049c85ab3e1512ada869e683d29
3
+ metadata.gz: 6d9d8bacd49a10a20da6b6eea12b64684e03e5d1
4
+ data.tar.gz: 03957e51a8a0201d41edabb67d3925f4c0c5016e
5
5
  SHA512:
6
- metadata.gz: a352f9266f6d457dd9fcdc67f60e858ad5bdb15e2f5f3f2fbad547730645bd2fbd5e96dd285236f7be8c2602d9544fb01beafdd7d26167ac0b241d593a83d625
7
- data.tar.gz: fa75491d988882c349233fdb9757f1449158d8d2f8fcc44e9b90e36e5beb45d73d9770cde9ef9979ba27ccc3309a9bab753c1a83ae23b54ec644f16e25362cf1
6
+ metadata.gz: 4b9e934062f8820ff47a87dd924a460b5969c6f7acad6aeff9e503d7aba53628282daef117a2ccacb9b5ac4a64a452d86505745d9e988ae8694a69429f8bfad7
7
+ data.tar.gz: 9187e861acac0fac799bab01abb383830398cd79119efad45896a6404e0b3bf4e31e8d9cf010fd01517eaaabf1c0c2e3805ec6a88128b15bd37927d9cc157420
@@ -1,3 +1,3 @@
1
1
  module EventStore
2
- VERSION = '0.8.2'
2
+ VERSION = '0.8.3'
3
3
  end
data/lib/event_store.rb CHANGED
@@ -135,6 +135,7 @@ module EventStore
135
135
  end
136
136
 
137
137
  def self.unescape_bytea(binary_string)
138
+ binary_string = [binary_string[1..-1]].pack("H*") if binary_string[0] == "x"
138
139
  [binary_string].pack("H*")
139
140
  end
140
141
 
@@ -108,7 +108,7 @@ describe EventStore::Client do
108
108
  client = es_client.new("any_device", :device)
109
109
  serialized_event = serialized_event_data_terminated_by_null
110
110
  event = EventStore::Event.new("any_device", @event_time, "terminated_by_null_event", "zone_number", serialized_event)
111
- retval = client.append([event])
111
+ client.append([event])
112
112
  hex_from_db = EventStore.db.from(EventStore.fully_qualified_table).order(:id).last[:serialized_event]
113
113
 
114
114
  expect(hex_from_db).to eql(EventStore.escape_bytea(serialized_event))
@@ -196,7 +196,7 @@ describe EventStore::Client do
196
196
  expect(subject.event_stream_between(start_time, end_time).length).to eq(1)
197
197
  end
198
198
 
199
- it "returns unencodes the serialized_event fields out of the database encoding" do
199
+ it "unencodes the serialized_event fields out of the database encoding" do
200
200
  expect(EventStore).to receive(:unescape_bytea).once
201
201
  start_time = @oldest_event_time
202
202
  end_time = @oldest_event_time
@@ -0,0 +1,23 @@
1
+ require "spec_helper"
2
+
3
+ module EventStore
4
+ describe "unescape_bytea" do
5
+ let(:original_string) { "the original string" }
6
+
7
+ context "when the string has been escaped once" do
8
+ let(:escaped_string) { EventStore.escape_bytea(original_string) }
9
+
10
+ it "returns the original string" do
11
+ expect(EventStore.unescape_bytea(escaped_string)).to eq(original_string)
12
+ end
13
+ end
14
+
15
+ context "when the string has been escaped twice" do
16
+ let(:escaped_string) { "x" + EventStore.escape_bytea(EventStore.escape_bytea(original_string)) }
17
+
18
+ it "returns the original string" do
19
+ expect(EventStore.unescape_bytea(escaped_string)).to eq(original_string)
20
+ end
21
+ end
22
+ end
23
+ end
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.8.2
4
+ version: 0.8.3
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-11-02 00:00:00.000000000 Z
12
+ date: 2015-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -213,6 +213,7 @@ files:
213
213
  - spec/event_store/vertica guy notes.txt
214
214
  - spec/spec_helper.rb
215
215
  - spec/unit/aggregate_unit_spec.rb
216
+ - spec/unit/escape_bytea_spec.rb
216
217
  - spec/unit/snapshot_unit_spec.rb
217
218
  homepage: https://github.com/nexiahome/event_store
218
219
  licenses:
@@ -251,4 +252,5 @@ test_files:
251
252
  - spec/event_store/vertica guy notes.txt
252
253
  - spec/spec_helper.rb
253
254
  - spec/unit/aggregate_unit_spec.rb
255
+ - spec/unit/escape_bytea_spec.rb
254
256
  - spec/unit/snapshot_unit_spec.rb