cony 1.1.0 → 1.1.1

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cony (1.1.0)
4
+ cony (1.1.1)
5
5
  activesupport (>= 3)
6
6
  bunny (~> 1.1.7)
7
7
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
@@ -18,6 +18,9 @@ module Cony
18
18
  persistent: Cony.config.durable,
19
19
  content_type: 'application/json')
20
20
  end
21
+ rescue => error
22
+ Airbrake.notify_or_ignore(error) if defined?(Airbrake)
23
+ Rails.logger.error("#{error.class}: #{error}") if defined?(Rails)
21
24
  end
22
25
 
23
26
  end
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'ostruct'
2
3
 
3
4
  require 'cony/amqp_connection_handler'
4
5
 
@@ -48,4 +49,34 @@ describe Cony::AMQPConnectionHandler do
48
49
  subject.publish(message, routing_key)
49
50
  end
50
51
 
52
+ describe 'error handling' do
53
+ before do
54
+ Bunny.stub(:run).and_raise('I failed so hard')
55
+ end
56
+
57
+ it 'does not raise an error' do
58
+ expect { subject.publish(message, routing_key) }.to_not raise_error
59
+ end
60
+
61
+ context 'Rails loaded' do
62
+ before do
63
+ stub_const('Rails', OpenStruct.new(logger: double('Railslogger')))
64
+ end
65
+ it 'logs an error' do
66
+ expect(Rails.logger).to receive(:error).with("RuntimeError: I failed so hard")
67
+ subject.publish(message, routing_key)
68
+ end
69
+ end
70
+
71
+ context 'Airbrake loaded' do
72
+ before do
73
+ stub_const('Airbrake', double('Airbrake'))
74
+ end
75
+ it 'sends the error' do
76
+ expect(Airbrake).to receive(:notify_or_ignore).with(instance_of(RuntimeError))
77
+ subject.publish(message, routing_key)
78
+ end
79
+ end
80
+ end
81
+
51
82
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cony
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -120,7 +120,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  segments:
122
122
  - 0
123
- hash: -2722824331661880657
123
+ hash: 191826322772385537
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  none: false
126
126
  requirements:
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  segments:
131
131
  - 0
132
- hash: -2722824331661880657
132
+ hash: 191826322772385537
133
133
  requirements: []
134
134
  rubyforge_project:
135
135
  rubygems_version: 1.8.23