fastly_nsq 1.15.0 → 1.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/fastly_nsq.gemspec +1 -1
- data/lib/fastly_nsq/listener.rb +2 -1
- data/lib/fastly_nsq/message.rb +5 -1
- data/lib/fastly_nsq/testing.rb +9 -0
- data/lib/fastly_nsq/version.rb +1 -1
- data/spec/message_spec.rb +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7ddfaca7ffa4121e56b173447b114ccd61ea104bc3804f2833920438492f4da
|
4
|
+
data.tar.gz: 570739450b84d445d190cb29b6d2ce7f22287bb4bde73f2af75e533eb00b2fc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b9b61eb6bfb2cc6453f259887e4b045368fc87ab4d88f05ef1591c83c1a488d36bf555034990495221a92ef697933a9ed0d007f650f0f11ee8bf4357f0b826d
|
7
|
+
data.tar.gz: 9e0202b599608733735097989d7f853b0e98def7299f366321509550ce9ea850ac23d757f81505bc2c7df1a73d3f742200b078733a9ba8036f6e96b175d7a4a5
|
data/Gemfile
CHANGED
data/fastly_nsq.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.require_paths = ['lib']
|
22
22
|
|
23
23
|
gem.add_development_dependency 'awesome_print', '~> 1.6'
|
24
|
-
gem.add_development_dependency 'bundler'
|
24
|
+
gem.add_development_dependency 'bundler'
|
25
25
|
gem.add_development_dependency 'dotenv'
|
26
26
|
gem.add_development_dependency 'pry-byebug', '~> 3.3'
|
27
27
|
gem.add_development_dependency 'rspec', '~> 3.4'
|
data/lib/fastly_nsq/listener.rb
CHANGED
@@ -116,8 +116,9 @@ class FastlyNsq::Listener
|
|
116
116
|
msg_info = {
|
117
117
|
channel: channel,
|
118
118
|
topic: topic,
|
119
|
-
attempts:
|
119
|
+
attempts: message.attempts,
|
120
120
|
id: Digest::MD5.hexdigest(nsq_message.body.to_s),
|
121
|
+
nsq_id: message.id,
|
121
122
|
metadata: message.meta,
|
122
123
|
}
|
123
124
|
|
data/lib/fastly_nsq/message.rb
CHANGED
@@ -20,7 +20,11 @@ class FastlyNsq::Message
|
|
20
20
|
# Delegated to +self.nsq_message+
|
21
21
|
# @return [Nsq::Message#timestamp]
|
22
22
|
# @see https://www.rubydoc.info/gems/nsq-ruby/Nsq/Message#timestamp-instance_method
|
23
|
-
|
23
|
+
# @!method id
|
24
|
+
# Delegated to +self.nsq_message+
|
25
|
+
# @return [Nsq::Message#id]
|
26
|
+
# @see https://www.rubydoc.info/gems/nsq-ruby/Nsq/Message#id-instance_method
|
27
|
+
def_delegators :@nsq_message, :attempts, :touch, :timestamp, :id
|
24
28
|
|
25
29
|
# @return [Symbol] Message state. Returns +nil+ if message has not been requeued or finished.
|
26
30
|
attr_reader :managed
|
data/lib/fastly_nsq/testing.rb
CHANGED
@@ -249,6 +249,10 @@ module FastlyNsq
|
|
249
249
|
|
250
250
|
FastlyNsq::Listener.prepend(ListenerTesting)
|
251
251
|
|
252
|
+
class FakeConnection
|
253
|
+
def connected?; end
|
254
|
+
end
|
255
|
+
|
252
256
|
module ConsumerTesting
|
253
257
|
module ClassMethods
|
254
258
|
def messages(topic = nil)
|
@@ -278,6 +282,11 @@ module FastlyNsq
|
|
278
282
|
@connected
|
279
283
|
end
|
280
284
|
|
285
|
+
def connect(*args)
|
286
|
+
return super(*args) unless FastlyNsq::Testing.enabled?
|
287
|
+
@connected = FakeConnection.new
|
288
|
+
end
|
289
|
+
|
281
290
|
def empty?
|
282
291
|
FastlyNsq::Testing.enabled? ? messages.empty? : super
|
283
292
|
end
|
data/lib/fastly_nsq/version.rb
CHANGED
data/spec/message_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
require 'json'
|
5
5
|
|
6
6
|
RSpec.describe FastlyNsq::Message do
|
7
|
-
let(:nsq_message) { double 'Nsq::Message', body: json_body, attempts: 1, finish: nil, requeue: nil, touch: nil, timestamp: nil }
|
7
|
+
let(:nsq_message) { double 'Nsq::Message', body: json_body, attempts: 1, finish: nil, requeue: nil, touch: nil, timestamp: nil, id: nil }
|
8
8
|
let(:body) { { 'data' => 'goes here', 'other_field' => 'is over here', 'meta' => 'meta stuff' } }
|
9
9
|
let(:json_body) { body.to_json }
|
10
10
|
subject { FastlyNsq::Message.new nsq_message }
|
@@ -30,7 +30,7 @@ RSpec.describe FastlyNsq::Message do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'delegates methods to the nsq_message object' do
|
33
|
-
%w[attempts finish requeue touch timestamp].each do |method|
|
33
|
+
%w[attempts finish requeue touch timestamp id].each do |method|
|
34
34
|
subject = FastlyNsq::Message.new nsq_message
|
35
35
|
expect(nsq_message).to receive(method)
|
36
36
|
|
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.16.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:
|
16
|
+
date: 2019-08-16 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: awesome_print
|
@@ -33,16 +33,16 @@ dependencies:
|
|
33
33
|
name: bundler
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
36
|
-
- - "
|
36
|
+
- - ">="
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version: '
|
38
|
+
version: '0'
|
39
39
|
type: :development
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
requirements:
|
43
|
-
- - "
|
43
|
+
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: '
|
45
|
+
version: '0'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: dotenv
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
270
270
|
version: '0'
|
271
271
|
requirements: []
|
272
272
|
rubyforge_project:
|
273
|
-
rubygems_version: 2.7.
|
273
|
+
rubygems_version: 2.7.9
|
274
274
|
signing_key:
|
275
275
|
specification_version: 4
|
276
276
|
summary: Fastly NSQ Adapter
|