rabbit_feed 2.3.7 → 2.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example/non_rails_app/Gemfile.lock +1 -1
- data/example/rails_app/Gemfile.lock +1 -1
- data/lib/rabbit_feed/configuration.rb +2 -2
- data/lib/rabbit_feed/version.rb +1 -1
- data/lib/rabbit_feed.rb +8 -4
- data/run_example +0 -1
- data/spec/lib/rabbit_feed/configuration_spec.rb +2 -2
- data/spec/lib/rabbit_feed/consumer_connection_spec.rb +26 -6
- data/spec/lib/rabbit_feed/producer_connection_spec.rb +24 -5
- data/spec/lib/rabbit_feed/producer_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d56c7c94bb76a6ee1a8ca77a5666d89dcc26fb30
|
4
|
+
data.tar.gz: 33e7a05722fe28047edb67132cd3902404c622ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10237bc7ef9d916b0bef1d389972063c388e41e3a76f875f494c219f37b431c45a3d63fb364bbdf735d08a68676979b49bc4c3618fb57050941bf21e650d9445
|
7
|
+
data.tar.gz: dc0bd78e8d2c5b6cf709650ca38a0ad90cc56fb00677eca97eac3f5dc27276a4619e459922855784906d4e7f09124430c3f082e4b20520c839c71ddb8f89e111
|
@@ -32,8 +32,8 @@ module RabbitFeed
|
|
32
32
|
raise ConfigurationError.new "The RabbitFeed configuration file path specified does not exist: #{file_path}" unless (File.exist? file_path)
|
33
33
|
|
34
34
|
options = read_configuration_file file_path, environment
|
35
|
-
options[:environment]
|
36
|
-
options[:application]
|
35
|
+
options[:environment] = environment
|
36
|
+
options[:application] = application if !!application
|
37
37
|
new options
|
38
38
|
end
|
39
39
|
|
data/lib/rabbit_feed/version.rb
CHANGED
data/lib/rabbit_feed.rb
CHANGED
@@ -34,7 +34,11 @@ module RabbitFeed
|
|
34
34
|
|
35
35
|
def exception_notify exception
|
36
36
|
if defined? Airbrake
|
37
|
-
(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
|
+
Airbrake.notify exception
|
41
|
+
end
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
@@ -50,9 +54,9 @@ module RabbitFeed
|
|
50
54
|
end
|
51
55
|
|
52
56
|
def set_defaults
|
53
|
-
self.log
|
54
|
-
self.configuration_file_path
|
55
|
-
self.environment
|
57
|
+
self.log ||= default_logger
|
58
|
+
self.configuration_file_path ||= 'config/rabbit_feed.yml'
|
59
|
+
self.environment ||= ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
56
60
|
end
|
57
61
|
private :set_defaults
|
58
62
|
|
data/run_example
CHANGED
@@ -27,7 +27,6 @@ echo 'Rails application consumer started'
|
|
27
27
|
# Start the rails application
|
28
28
|
echo 'Starting rails application...'
|
29
29
|
pushd example/rails_app >/dev/null
|
30
|
-
nodenv local v0.10 >/dev/null
|
31
30
|
bundle exec unicorn -c config/unicorn.rb -D
|
32
31
|
sleep 1
|
33
32
|
popd >/dev/null
|
@@ -117,8 +117,8 @@ module RabbitFeed
|
|
117
117
|
context 'with application provided' do
|
118
118
|
let(:application) { 'new_application' }
|
119
119
|
|
120
|
-
it 'prefers the application
|
121
|
-
expect(subject.application).to eq '
|
120
|
+
it 'prefers the application provided' do
|
121
|
+
expect(subject.application).to eq 'new_application'
|
122
122
|
end
|
123
123
|
|
124
124
|
context 'with an empty config file' do
|
@@ -80,16 +80,36 @@ module RabbitFeed
|
|
80
80
|
context 'when an exception is raised' do
|
81
81
|
|
82
82
|
context 'when Airbrake is defined' do
|
83
|
-
|
84
|
-
|
83
|
+
after { Object.send(:remove_const, ('Airbrake').to_sym) rescue NameError }
|
84
|
+
|
85
|
+
context 'when the version is lower than 5' do
|
86
|
+
before do
|
87
|
+
module ::Airbrake
|
88
|
+
VERSION = '4.0.0'
|
89
|
+
end
|
90
|
+
allow(Airbrake).to receive(:configuration).and_return(airbrake_configuration)
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'and the Airbrake configuration is public' do
|
94
|
+
let(:airbrake_configuration) { double(:airbrake_configuration, public?: true) }
|
95
|
+
|
96
|
+
it 'notifies airbrake' do
|
97
|
+
expect(Airbrake).to receive(:notify_or_ignore).with(an_instance_of RuntimeError)
|
98
|
+
|
99
|
+
expect{ subject.consume { raise 'Consuming time' } }.not_to raise_error
|
100
|
+
end
|
101
|
+
end
|
85
102
|
end
|
86
103
|
|
87
|
-
context '
|
88
|
-
|
104
|
+
context 'when the version is greater than 4' do
|
105
|
+
before do
|
106
|
+
module ::Airbrake
|
107
|
+
AIRBRAKE_VERSION = '5.0.0'
|
108
|
+
end
|
109
|
+
end
|
89
110
|
|
90
111
|
it 'notifies airbrake' do
|
91
|
-
expect(Airbrake).to receive(:
|
92
|
-
|
112
|
+
expect(Airbrake).to receive(:notify).with(an_instance_of RuntimeError)
|
93
113
|
expect{ subject.consume { raise 'Consuming time' } }.not_to raise_error
|
94
114
|
end
|
95
115
|
end
|
@@ -19,17 +19,36 @@ module RabbitFeed
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe '#handle_returned_message' do
|
22
|
+
after { Object.send(:remove_const, ('Airbrake').to_sym) rescue NameError }
|
22
23
|
|
23
24
|
context 'when Airbrake is defined' do
|
24
|
-
|
25
|
-
|
25
|
+
context 'when the version is lower than 5' do
|
26
|
+
before do
|
27
|
+
module ::Airbrake
|
28
|
+
VERSION = '4.0.0'
|
29
|
+
end
|
30
|
+
allow(Airbrake).to receive(:configuration).and_return(airbrake_configuration)
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'and the Airbrake configuration is public' do
|
34
|
+
let(:airbrake_configuration) { double(:airbrake_configuration, public?: true) }
|
35
|
+
|
36
|
+
it 'notifies Airbrake of the return' do
|
37
|
+
expect(Airbrake).to receive(:notify_or_ignore).with(an_instance_of ReturnedMessageError)
|
38
|
+
described_class.handle_returned_message 1, 2
|
39
|
+
end
|
40
|
+
end
|
26
41
|
end
|
27
42
|
|
28
|
-
context '
|
29
|
-
|
43
|
+
context 'when the version is greater than 4' do
|
44
|
+
before do
|
45
|
+
module ::Airbrake
|
46
|
+
AIRBRAKE_VERSION = '5.0.0'
|
47
|
+
end
|
48
|
+
end
|
30
49
|
|
31
50
|
it 'notifies Airbrake of the return' do
|
32
|
-
expect(Airbrake).to receive(:
|
51
|
+
expect(Airbrake).to receive(:notify).with(an_instance_of ReturnedMessageError)
|
33
52
|
described_class.handle_returned_message 1, 2
|
34
53
|
end
|
35
54
|
end
|
@@ -42,7 +42,7 @@ module RabbitFeed
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'sets the event metadata' do
|
45
|
-
Timecop.freeze(Time.
|
45
|
+
Timecop.freeze(Time.gm(1990)) do
|
46
46
|
expect(subject.metadata).to match({
|
47
47
|
'application' => 'rabbit_feed',
|
48
48
|
'created_at_utc' => '1990-01-01T00:00:00.000000Z',
|
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: 2.3.
|
4
|
+
version: 2.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simply Business
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|