rabbit_feed 3.0.0 → 3.0.1

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
  SHA1:
3
- metadata.gz: 341e94f0f96334c74f5f14a9bd394cb076602342
4
- data.tar.gz: d6a2b2fea2255493db135aec552d48493d2e35fd
3
+ metadata.gz: 0dd9a18fb2e4684fc9680be20a40caa49605c22e
4
+ data.tar.gz: 61f4a4c44a773c7cf649dc6a80216cb261d8ae68
5
5
  SHA512:
6
- metadata.gz: 7975aa142d54f3c36880776842680d6b7c1b07c0d3a3973d2622149b2801d303b1b4d99bd26245483827fef0dad1470cdb081984e23dff57d43d03352c9c1f34
7
- data.tar.gz: 396188946a955bd285ea5146e33652f171501e5f54a349431917df947a3e9e87c386ffb6c158a9b3993c460ae5c79c882424787c88ad3b732821600a1559f4f3
6
+ metadata.gz: 66657f7a397849d419d01a62a52c8f43e011025affb5772205f3fbc8c719f76ff1ad2f7407ea3a50675e62bf6320bb43ac8eb70c220a45a9f14caf1aade04bfc
7
+ data.tar.gz: 51998a861c4fba7d1f25fa0b0bd53ddd8c3343fa3c0c64959ef03bcdc4fabd7414363bc83d4cd2ed3baf30528504bedd2635ed01c40b264753fc867e8cb684e9
data/.rubocop.yml CHANGED
@@ -28,7 +28,6 @@ Metrics/ClassLength:
28
28
  Metrics/CyclomaticComplexity:
29
29
  Exclude:
30
30
  - 'lib/rabbit_feed/configuration.rb'
31
- - 'lib/rabbit_feed.rb'
32
31
  - 'lib/rabbit_feed/testing_support/rspec_matchers/publish_event.rb'
33
32
 
34
33
  Metrics/LineLength:
@@ -45,7 +44,6 @@ Metrics/ModuleLength:
45
44
  Metrics/PerceivedComplexity:
46
45
  Exclude:
47
46
  - 'lib/rabbit_feed/configuration.rb'
48
- - 'lib/rabbit_feed.rb'
49
47
  - 'lib/rabbit_feed/testing_support/rspec_matchers/publish_event.rb'
50
48
 
51
49
  Style/Documentation:
data/README.md CHANGED
@@ -119,7 +119,7 @@ The event will be published to the configured exchange on RabbitMQ (`amq.topic`
119
119
 
120
120
  ### Returned Events
121
121
 
122
- In the case that there are no consumers configured to subscribe to an event, the event will be returned to the producer. The returned event will be logged, and if your project uses [Airbrake](https://airbrake.io), an error will be reported there.
122
+ In the case that there are no consumers configured to subscribe to an event, the event will be returned to the producer. The returned event will be logged, and if your project uses [Airbrake (v5.0+) or Airbrake-Ruby](https://airbrake.io), an error will be reported there.
123
123
 
124
124
  ### Testing the Producer
125
125
 
@@ -238,7 +238,7 @@ More information about the consumer command line options can be found [here](htt
238
238
 
239
239
  ### Event Processing Errors
240
240
 
241
- In the case that your consumer raises an error whilst processing an event, the error will be logged. If your project uses [Airbrake](https://airbrake.io), the error will also be reported there. The event that was being processed will remain on the RabbitMQ queue, and will be redelivered to the consumer until it is processed without error.
241
+ In the case that your consumer raises an error whilst processing an event, the error will be logged. If your project uses [Airbrake (v5.0+) or Airbrake-Ruby](https://airbrake.io), the error will also be reported there. The event that was being processed will remain on the RabbitMQ queue, and will be redelivered to the consumer until it is processed without error.
242
242
 
243
243
  ### Testing the Consumer
244
244
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- rabbit_feed (3.0.0)
4
+ rabbit_feed (3.0.1)
5
5
  activemodel (>= 3.2.0, < 6.0.0)
6
6
  activesupport (>= 3.2.0, < 6.0.0)
7
7
  avro (>= 1.5.4, < 1.9.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- rabbit_feed (3.0.0)
4
+ rabbit_feed (3.0.1)
5
5
  activemodel (>= 3.2.0, < 6.0.0)
6
6
  activesupport (>= 3.2.0, < 6.0.0)
7
7
  avro (>= 1.5.4, < 1.9.0)
data/lib/rabbit_feed.rb CHANGED
@@ -34,17 +34,13 @@ module RabbitFeed
34
34
 
35
35
  def exception_notify(exception)
36
36
  return unless defined?(Airbrake)
37
- if defined?(Airbrake::VERSION) && Airbrake::VERSION.to_i < 5
38
- (Airbrake.notify_or_ignore exception) if Airbrake.configuration.public?
39
- elsif defined?(Airbrake::AIRBRAKE_VERSION) && Airbrake::AIRBRAKE_VERSION.to_i >= 5
40
- if RabbitFeed.configuration.consumer_exit_after_fail
41
- # Will need to send the notification right away, otherwise the `exit` would kill the
42
- # Airbrake before the notification is sent out
43
- Airbrake.notify_sync exception
44
- else
45
- # Airbrake notify default to sending notification asynchronously
46
- Airbrake.notify exception
47
- end
37
+ if RabbitFeed.configuration.consumer_exit_after_fail
38
+ # Will need to send the notification right away, otherwise the `exit` would kill the
39
+ # Airbrake before the notification is sent out
40
+ Airbrake.notify_sync exception
41
+ else
42
+ # Airbrake notify default to sending notification asynchronously
43
+ Airbrake.notify exception
48
44
  end
49
45
  end
50
46
 
@@ -1,3 +1,3 @@
1
1
  module RabbitFeed
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '3.0.1'.freeze
3
3
  end
@@ -116,52 +116,25 @@ module RabbitFeed
116
116
  before { allow(RabbitFeed.configuration).to receive(:consumer_exit_after_fail).and_return(false) }
117
117
 
118
118
  context 'when Airbrake is defined' do
119
- after do
120
- begin
121
- Object.send(:remove_const, 'Airbrake'.to_sym)
122
- rescue NameError; end
119
+ around do |example|
120
+ module ::Airbrake; end
121
+ example.run
122
+ Object.send(:remove_const, 'Airbrake'.to_sym)
123
123
  end
124
124
 
125
- context 'when the version is lower than 5' do
126
- before do
127
- module ::Airbrake
128
- VERSION = '4.0.0'.freeze
129
- end
130
- allow(Airbrake).to receive(:configuration).and_return(airbrake_configuration)
131
- end
132
-
133
- context 'and the Airbrake configuration is public' do
134
- let(:airbrake_configuration) { double(:airbrake_configuration, public?: true) }
135
-
136
- it 'notifies airbrake' do
137
- expect(Airbrake).to receive(:notify_or_ignore).with(an_instance_of(RuntimeError))
138
-
139
- expect { subject.consume { raise 'Consuming time' } }.not_to raise_error
140
- end
125
+ context 'and consumer_exit_after_fail is true' do
126
+ before { allow(RabbitFeed.configuration).to receive(:consumer_exit_after_fail).and_return(true) }
127
+ it 'notifies airbrake synchronously' do
128
+ expect(Airbrake).to receive(:notify_sync).with(an_instance_of(RuntimeError))
129
+ expect { subject.consume { raise 'Consuming time' } }.not_to raise_error
141
130
  end
142
131
  end
143
132
 
144
- context 'when the version is greater than 4' do
145
- before do
146
- module ::Airbrake
147
- AIRBRAKE_VERSION = '5.0.0'.freeze
148
- end
149
- end
150
-
151
- context 'and consumer_exit_after_fail is true' do
152
- before { allow(RabbitFeed.configuration).to receive(:consumer_exit_after_fail).and_return(true) }
153
- it 'notifies airbrake synchronously' do
154
- expect(Airbrake).to receive(:notify_sync).with(an_instance_of(RuntimeError))
155
- expect { subject.consume { raise 'Consuming time' } }.not_to raise_error
156
- end
157
- end
158
-
159
- context 'and consumer_exit_after_fail is not true' do
160
- before { allow(RabbitFeed.configuration).to receive(:consumer_exit_after_fail).and_return(false) }
161
- it 'notifies airbrake' do
162
- expect(Airbrake).to receive(:notify).with(an_instance_of(RuntimeError))
163
- expect { subject.consume { raise 'Consuming time' } }.not_to raise_error
164
- end
133
+ context 'and consumer_exit_after_fail is not true' do
134
+ before { allow(RabbitFeed.configuration).to receive(:consumer_exit_after_fail).and_return(false) }
135
+ it 'notifies airbrake' do
136
+ expect(Airbrake).to receive(:notify).with(an_instance_of(RuntimeError))
137
+ expect { subject.consume { raise 'Consuming time' } }.not_to raise_error
165
138
  end
166
139
  end
167
140
  end
@@ -19,42 +19,16 @@ module RabbitFeed
19
19
  end
20
20
 
21
21
  describe '#handle_returned_message' do
22
- after do
23
- begin
24
- Object.send(:remove_const, 'Airbrake'.to_sym)
25
- rescue NameError; end
26
- end
27
-
28
22
  context 'when Airbrake is defined' do
29
- context 'when the version is lower than 5' do
30
- before do
31
- module ::Airbrake
32
- VERSION = '4.0.0'.freeze
33
- end
34
- allow(Airbrake).to receive(:configuration).and_return(airbrake_configuration)
35
- end
36
-
37
- context 'and the Airbrake configuration is public' do
38
- let(:airbrake_configuration) { double(:airbrake_configuration, public?: true) }
39
-
40
- it 'notifies Airbrake of the return' do
41
- expect(Airbrake).to receive(:notify_or_ignore).with(an_instance_of(ReturnedMessageError))
42
- described_class.handle_returned_message 1, 2
43
- end
44
- end
23
+ around do |example|
24
+ module ::Airbrake; end
25
+ example.run
26
+ Object.send(:remove_const, 'Airbrake'.to_sym)
45
27
  end
46
28
 
47
- context 'when the version is greater than 4' do
48
- before do
49
- module ::Airbrake
50
- AIRBRAKE_VERSION = '5.0.0'.freeze
51
- end
52
- end
53
-
54
- it 'notifies Airbrake of the return' do
55
- expect(Airbrake).to receive(:notify).with(an_instance_of(ReturnedMessageError))
56
- described_class.handle_returned_message 1, 2
57
- end
29
+ it 'notifies Airbrake of the return' do
30
+ expect(Airbrake).to receive(:notify).with(an_instance_of(ReturnedMessageError))
31
+ described_class.handle_returned_message 1, 2
58
32
  end
59
33
  end
60
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit_feed
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simply Business
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-02 00:00:00.000000000 Z
11
+ date: 2017-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny