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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 135337a9892fdb4e0ddb5d448cae0f9d298b66a3a1a2d53966b9ba1c3c31d734
4
- data.tar.gz: 103ab244297b6e29b0f50fdda88881cbe030943b2d019dcf31f9080203b8d36b
3
+ metadata.gz: b7ddfaca7ffa4121e56b173447b114ccd61ea104bc3804f2833920438492f4da
4
+ data.tar.gz: 570739450b84d445d190cb29b6d2ce7f22287bb4bde73f2af75e533eb00b2fc3
5
5
  SHA512:
6
- metadata.gz: 948bd9896a2709c88b2dffdfc8fa13de42d8f0d46f62c8cd635ff4323dd57a2be75cb805598a6878059a7416aa5e78f719cd4d026462833fe609168a46e8ebd9
7
- data.tar.gz: 299eb6013dc14fd5f7fc84e752d75b60c633883e60517b9f507e7247bca4d6bb0a2ca4825cffc8b3836697208e76cac464a83ec25bda5119b852c724b25b82bc
6
+ metadata.gz: 9b9b61eb6bfb2cc6453f259887e4b045368fc87ab4d88f05ef1591c83c1a488d36bf555034990495221a92ef697933a9ed0d007f650f0f11ee8bf4357f0b826d
7
+ data.tar.gz: 9e0202b599608733735097989d7f853b0e98def7299f366321509550ce9ea850ac23d757f81505bc2c7df1a73d3f742200b078733a9ba8036f6e96b175d7a4a5
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'bundler-audit', '~> 0.5.0'
7
+ gem 'bundler-audit'
8
8
  gem 'newrelic_rpm', require: false
9
9
  gem 'overcommit', '~> 0.32.0'
10
10
  gem 'rake', '~> 11.1.2'
@@ -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', '~> 1.12'
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'
@@ -116,8 +116,9 @@ class FastlyNsq::Listener
116
116
  msg_info = {
117
117
  channel: channel,
118
118
  topic: topic,
119
- attempts: nsq_message.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
 
@@ -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
- def_delegators :@nsq_message, :attempts, :touch, :timestamp
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastlyNsq
4
- VERSION = '1.15.0'
4
+ VERSION = '1.16.0'
5
5
  end
@@ -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.15.0
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: 2018-10-05 00:00:00.000000000 Z
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: '1.12'
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: '1.12'
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.6
273
+ rubygems_version: 2.7.9
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: Fastly NSQ Adapter