fastly_nsq 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fastly_nsq.gemspec +1 -0
- data/lib/fastly_nsq/messenger.rb +1 -0
- data/lib/fastly_nsq/version.rb +1 -1
- data/spec/messenger_spec.rb +8 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be99f97fe78325dd7d99285e0f7f63387ad20cc3
|
4
|
+
data.tar.gz: a85de6cdf4520e2e83844f71f6feaab7d1f81865
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a200725047fd0b365e03041b4a7806c7bee7daa557b2f6919dcd5f562b43c982d5597257c62b698de46aba63b02752ef970b22ea47f342183b911015676e7a29
|
7
|
+
data.tar.gz: 3ddcf60d8bc3c62d9af1726a05135296b131effa6f9319c8665d39b2d4b9d6d08977f9aecd00bbe618894f8b1c5ffeedd09826487f52430638e214aa23f7a55c
|
data/fastly_nsq.gemspec
CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |gem|
|
|
26
26
|
gem.add_development_dependency 'pry-byebug', '~> 3.3'
|
27
27
|
gem.add_development_dependency 'rspec', '~> 3.4'
|
28
28
|
gem.add_development_dependency 'rspec-eventually', '0.2'
|
29
|
+
gem.add_development_dependency 'timecop'
|
29
30
|
gem.add_development_dependency 'webmock', '~> 3.0'
|
30
31
|
|
31
32
|
gem.add_dependency 'concurrent-ruby', '~> 1.0'
|
data/lib/fastly_nsq/messenger.rb
CHANGED
data/lib/fastly_nsq/version.rb
CHANGED
data/spec/messenger_spec.rb
CHANGED
@@ -8,12 +8,14 @@ RSpec.describe FastlyNsq::Messenger do
|
|
8
8
|
let(:message) { { sample: 'sample', message: 'message' } }
|
9
9
|
let(:producer) { double 'FastlyNsq::Producer', write: nil, terminate: :terminated }
|
10
10
|
let(:origin) { 'originating_service' }
|
11
|
+
let(:sent_at) { Time.now.iso8601(5) }
|
11
12
|
|
12
13
|
let(:expected_attributes) do
|
13
14
|
{
|
14
15
|
data: message,
|
15
16
|
meta: {
|
16
17
|
originating_service: 'originating_service',
|
18
|
+
sent_at: sent_at,
|
17
19
|
},
|
18
20
|
}
|
19
21
|
end
|
@@ -25,6 +27,8 @@ RSpec.describe FastlyNsq::Messenger do
|
|
25
27
|
end
|
26
28
|
|
27
29
|
describe '#deliver' do
|
30
|
+
before { Timecop.freeze(sent_at) }
|
31
|
+
|
28
32
|
it 'writes a single message on a producer' do
|
29
33
|
subject.producers['topic'] = producer
|
30
34
|
|
@@ -45,7 +49,7 @@ RSpec.describe FastlyNsq::Messenger do
|
|
45
49
|
it 'allows setting arbitrary metadata' do
|
46
50
|
meta = { test: 'test' }
|
47
51
|
|
48
|
-
expected_attributes = { data: message, meta: meta.merge(originating_service: origin) }
|
52
|
+
expected_attributes = { data: message, meta: meta.merge(originating_service: origin, sent_at: sent_at) }
|
49
53
|
|
50
54
|
subject.producers['topic'] = producer
|
51
55
|
|
@@ -57,7 +61,7 @@ RSpec.describe FastlyNsq::Messenger do
|
|
57
61
|
it 'prevents originating_service from being overwritten by meta' do
|
58
62
|
meta = { test: 'test' }
|
59
63
|
|
60
|
-
expected_attributes = { data: message, meta: meta.merge(originating_service: origin) }
|
64
|
+
expected_attributes = { data: message, meta: meta.merge(originating_service: origin, sent_at: sent_at) }
|
61
65
|
|
62
66
|
meta[:originating_service] = 'other_service'
|
63
67
|
|
@@ -70,6 +74,8 @@ RSpec.describe FastlyNsq::Messenger do
|
|
70
74
|
end
|
71
75
|
|
72
76
|
describe '#originating_service=' do
|
77
|
+
before { Timecop.freeze(sent_at) }
|
78
|
+
|
73
79
|
it "set's the default originating service" do
|
74
80
|
subject.producers['nanotopic'] = producer
|
75
81
|
service = 'nano service'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastly_nsq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tommy O'Neil
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2018-04-
|
16
|
+
date: 2018-04-26 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: awesome_print
|
@@ -99,6 +99,20 @@ dependencies:
|
|
99
99
|
- - '='
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0.2'
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: timecop
|
104
|
+
requirement: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
type: :development
|
110
|
+
prerelease: false
|
111
|
+
version_requirements: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
102
116
|
- !ruby/object:Gem::Dependency
|
103
117
|
name: webmock
|
104
118
|
requirement: !ruby/object:Gem::Requirement
|