banter 1.3.2 → 1.4.0

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: 80b25572909dce4687781d01504ef62769092c27
4
- data.tar.gz: 624e2969816519a17dd03a09b2a972261b38b2d8
3
+ metadata.gz: bbcfd4c67610fef0339ce5fb31e14fd975e89d69
4
+ data.tar.gz: 626912b7090d2cd191f1c87d846f2c2c3f62d9d7
5
5
  SHA512:
6
- metadata.gz: 53058a6a8953dfe2e937e38ce5e866af1cb0813076296707840cab4a3dc32d7923f78aae6f99dc362b76e94709ea649947249df9864d16b5927333e887873a5f
7
- data.tar.gz: 15bf4626708359c18557a104cd9b7d627ca0d475698b7561dd3796f9fe1c5497fb6f538fec52fe25e173e1c426a3d498446a802aad5cadf5c1bcf00792ccacd6
6
+ metadata.gz: b35cd93ce40832b90000c56d054587a7ea49f5e2c651a3d9b960fd68ab041645ed19f17860868821619fa8f0cf1df115a49823dc4a8e743f498b5d68d4303572
7
+ data.tar.gz: a9cc50ad7416642328b91c463266e7eb0db72c18d0dbd7ca0c93fef0bd8ccf91edfe9ddf9d547b8ead606b4df985dcf9f912e55b23b82b8499e7bb5746289c79
data/Gemfile CHANGED
@@ -10,7 +10,7 @@ group :test do
10
10
  gem 'rspec-its'
11
11
  gem 'sinatra'
12
12
  gem 'haml'
13
- gem 'mongoid', github: 'mongoid/mongoid'
13
+ gem 'mongoid', "~>4.0"
14
14
  gem 'timecop'
15
15
  gem "factory_girl", "~> 4.0"
16
16
  end
data/banter.gemspec CHANGED
@@ -21,12 +21,12 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rake", ">= 10.0"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "rspec", "~> 3.0.0"
26
- spec.add_runtime_dependency "activesupport", ">= 3.2"
26
+ spec.add_runtime_dependency "activesupport", "~> 4.1"
27
27
  spec.add_runtime_dependency "awesome_print", "~> 1.2.0"
28
- spec.add_runtime_dependency "bunny", ">= 1.2"
29
- spec.add_runtime_dependency "airbrake", ">= 3.1"
28
+ spec.add_runtime_dependency "bunny", "~> 1.2"
29
+ spec.add_runtime_dependency "airbrake", "~> 3.1"
30
30
  spec.add_runtime_dependency "hashie", ">= 1.2"
31
31
  spec.add_runtime_dependency "json", ">= 1.8"
32
32
  spec.add_runtime_dependency "celluloid", ">= 0.15"
@@ -38,7 +38,7 @@ module Banter
38
38
  track_message_failed(banter_error, false)
39
39
  Banter::RabbitLogger.log(::Logger::ERROR, { worker: worker_class.name, message: banter_error.message, envelope: envelope })
40
40
  Airbrake.notify(banter_error,
41
- params: {
41
+ parameters: {
42
42
  info: delivery_info,
43
43
  properties: properties,
44
44
  context: envelope[:context],
@@ -48,9 +48,9 @@ module Banter
48
48
  raise banter_error
49
49
  rescue => e
50
50
  track_message_failed(e, true)
51
- Banter::RabbitLogger.log(::Logger::DEBUG, "Failed message for #{worker_class.name} #{e.message}")
51
+ Banter::RabbitLogger.log(::Logger::ERROR, "Failed message for #{worker_class.name} #{e.message}")
52
52
  Airbrake.notify(e,
53
- params: {
53
+ parameters: {
54
54
  info: delivery_info,
55
55
  properties: properties,
56
56
  context: envelope[:context],
@@ -37,7 +37,7 @@ module Banter
37
37
  @connection.start
38
38
  rescue => e
39
39
  Banter::RabbitLogger.log(Logger::ERROR, "Cannot connect to rabbitmq")
40
- Airbrake.notify(e, params: { message: e.message, what_happened: "RabbitMQ unreachable!" }, environment_name: environment)
40
+ Airbrake.notify(e, parameters: { message: e.message, what_happened: "RabbitMQ unreachable!" }, environment_name: environment)
41
41
  raise e
42
42
  end
43
43
 
@@ -70,7 +70,7 @@ module Banter
70
70
 
71
71
  if delivery_info[:redelivered]
72
72
  e = StandardError.new("PubSub Message redelivery")
73
- Airbrake.notify(e, params: { info: delivery_info, props: properties, contents: contents }, backtrace: caller)
73
+ Airbrake.notify(e, parameters: { info: delivery_info, props: properties, contents: contents }, backtrace: caller)
74
74
  end
75
75
 
76
76
  Banter::RabbitLogger.log_receive(delivery_info[:routing_key], envelope)
@@ -89,14 +89,14 @@ module Banter
89
89
  # Does not get put back on the queue, and instead, will need to be processed either by the log parser
90
90
  # later or by dead letter exchange
91
91
  @channel.reject(token, false)
92
- Airbrake.notify(e, params: { delivery_info: delivery_info, properties: properties, contents: contents, error: e.message }, environment_name: environment)
92
+ Airbrake.notify(e, parameters: { delivery_info: delivery_info, properties: properties, contents: contents, error: e.message }, environment_name: environment)
93
93
  end
94
94
  end
95
95
 
96
96
  def notify_error(error, consumer)
97
97
  Banter::RabbitLogger.log(Logger::WARN, "Error with the message: #{error.message}: #{consumer}")
98
98
  Banter::RabbitLogger.log(Logger::WARN, "#{caller.inspect}")
99
- Airbrake.notify(error, params: { consumer: consumer, error: error.message }, environment_name: environment)
99
+ Airbrake.notify(error, parameters: { consumer: consumer, error: error.message }, environment_name: environment)
100
100
  end
101
101
 
102
102
  def teardown
@@ -104,7 +104,7 @@ module Banter
104
104
  @consumer.cancel if @consumer.present?
105
105
  @connection.close if @connection.present?
106
106
  rescue => e
107
- Airbrake.notify(e, params: { error: e.message }, environment_name: environment)
107
+ Airbrake.notify(e, parameters: { error: e.message }, environment_name: environment)
108
108
  end
109
109
  end
110
110
 
@@ -1,3 +1,3 @@
1
1
  module Banter
2
- VERSION = "1.3.2"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -15,12 +15,14 @@ describe Banter::Publisher do
15
15
  end
16
16
  double("::Bunny::Channel", :topic=> topic)
17
17
  }
18
- let(:publish_fails){ false}
18
+ let(:publish_fails){ false }
19
+ let(:session_mock) { Bunny::Session.new }
19
20
 
20
21
  before do
22
+ session_mock
23
+ publisher
21
24
  allow(Banter::RabbitLogger).to receive(:log_publish)
22
- allow_any_instance_of(::Bunny::Session).to receive(:start).and_return(true)
23
- allow_any_instance_of(::Bunny::Session).to receive(:create_channel) { channel_mocker }
25
+ allow(::Bunny::Session).to receive(:new).and_return(session_mock)
24
26
  allow(Banter::RabbitLogger).to receive(:log)
25
27
  end
26
28
 
@@ -37,7 +39,6 @@ describe Banter::Publisher do
37
39
 
38
40
  it "should attempt to publish twice" do
39
41
  result
40
- expect(Banter::RabbitLogger).to have_received(:log_publish).exactly(2).times
41
42
  expect(Banter::RabbitLogger).to have_received(:log).with(Logger::INFO, /Publishing all messages from delayed publish/)
42
43
  expect(Banter::RabbitLogger).to have_received(:log).with(Logger::INFO, /to delayed publish with/).exactly(2).times
43
44
  end
@@ -61,11 +62,12 @@ describe Banter::Publisher do
61
62
  }
62
63
 
63
64
  before do
65
+ allow(publisher).to receive(:execute_publish).and_call_original
64
66
  result
65
67
  end
66
68
 
67
69
  it "should attempt to publish three times" do
68
- expect(Banter::RabbitLogger).to have_received(:log_publish).exactly(3).times
70
+ expect(publisher).to have_received(:execute_publish).exactly(3).times
69
71
  end
70
72
  end
71
73
 
@@ -76,14 +78,18 @@ describe Banter::Publisher do
76
78
  publisher.publish(context, "second", "two")
77
79
  }
78
80
 
79
- it "should have added to the message list twice that will be published last" do
80
- expect_any_instance_of(Banter::Publisher).to receive(:add_message).exactly(2).times
81
+ before do
82
+ allow(publisher).to receive(:add_message).and_call_original
83
+ allow(publisher).to receive(:execute_publish).and_call_original
81
84
  result
82
85
  end
83
86
 
84
87
  it "should have added to the message list twice that will be published last" do
85
- expect_any_instance_of(Banter::Publisher).to receive(:execute_publish).exactly(2).times
86
- result
88
+ expect(publisher).to have_received(:add_message).exactly(2).times
89
+ end
90
+
91
+ it "should have added to the message list twice that will be published last" do
92
+ expect(publisher).to have_received(:execute_publish).exactly(2).times
87
93
  end
88
94
 
89
95
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: banter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Honest Company
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-10-28 00:00:00.000000000 Z
14
+ date: 2015-09-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -31,14 +31,14 @@ dependencies:
31
31
  name: rake
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - '>='
34
+ - - ~>
35
35
  - !ruby/object:Gem::Version
36
36
  version: '10.0'
37
37
  type: :development
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - '>='
41
+ - - ~>
42
42
  - !ruby/object:Gem::Version
43
43
  version: '10.0'
44
44
  - !ruby/object:Gem::Dependency
@@ -59,16 +59,16 @@ dependencies:
59
59
  name: activesupport
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - '>='
62
+ - - ~>
63
63
  - !ruby/object:Gem::Version
64
- version: '3.2'
64
+ version: '4.1'
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - '>='
69
+ - - ~>
70
70
  - !ruby/object:Gem::Version
71
- version: '3.2'
71
+ version: '4.1'
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: awesome_print
74
74
  requirement: !ruby/object:Gem::Requirement
@@ -87,28 +87,28 @@ dependencies:
87
87
  name: bunny
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - '>='
90
+ - - ~>
91
91
  - !ruby/object:Gem::Version
92
92
  version: '1.2'
93
93
  type: :runtime
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - '>='
97
+ - - ~>
98
98
  - !ruby/object:Gem::Version
99
99
  version: '1.2'
100
100
  - !ruby/object:Gem::Dependency
101
101
  name: airbrake
102
102
  requirement: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - '>='
104
+ - - ~>
105
105
  - !ruby/object:Gem::Version
106
106
  version: '3.1'
107
107
  type: :runtime
108
108
  prerelease: false
109
109
  version_requirements: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ~>
112
112
  - !ruby/object:Gem::Version
113
113
  version: '3.1'
114
114
  - !ruby/object:Gem::Dependency
@@ -275,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
275
  version: '0'
276
276
  requirements: []
277
277
  rubyforge_project:
278
- rubygems_version: 2.2.2
278
+ rubygems_version: 2.4.3
279
279
  signing_key:
280
280
  specification_version: 4
281
281
  summary: Library for pub-sub (Message Bus)