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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46ec22406bf0b402aac611249d2d6d6f73d68f5a
4
- data.tar.gz: a818565a86d18854c86462fa98c28c0be45b7913
3
+ metadata.gz: d56c7c94bb76a6ee1a8ca77a5666d89dcc26fb30
4
+ data.tar.gz: 33e7a05722fe28047edb67132cd3902404c622ab
5
5
  SHA512:
6
- metadata.gz: ecc5101d86353f8377943623d8b7805f7ef6101b7d90092ed97cb60396a9dcb5573081562c01a36f2bdc3504e83e7515448c8aca60225d9985a64b5de0a1f337
7
- data.tar.gz: 1da54c92be195050c2815a3a84a2a3be37aa99e2a00b15ba6edddc24dc4e4594cccf7aba620b0f358fbdc217fa033f00a9e433f9d2d4d2551ecad4ad8b66b96d
6
+ metadata.gz: 10237bc7ef9d916b0bef1d389972063c388e41e3a76f875f494c219f37b431c45a3d63fb364bbdf735d08a68676979b49bc4c3618fb57050941bf21e650d9445
7
+ data.tar.gz: dc0bd78e8d2c5b6cf709650ca38a0ad90cc56fb00677eca97eac3f5dc27276a4619e459922855784906d4e7f09124430c3f082e4b20520c839c71ddb8f89e111
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- rabbit_feed (2.3.7)
4
+ rabbit_feed (2.3.9)
5
5
  activemodel (>= 3.2.0, < 5.0.0)
6
6
  activesupport (>= 3.2.0, < 5.0.0)
7
7
  avro (>= 1.5.4, < 1.8.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- rabbit_feed (2.3.7)
4
+ rabbit_feed (2.3.9)
5
5
  activemodel (>= 3.2.0, < 5.0.0)
6
6
  activesupport (>= 3.2.0, < 5.0.0)
7
7
  avro (>= 1.5.4, < 1.8.0)
@@ -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] = environment
36
- options[:application] ||= application
35
+ options[:environment] = environment
36
+ options[:application] = application if !!application
37
37
  new options
38
38
  end
39
39
 
@@ -1,3 +1,3 @@
1
1
  module RabbitFeed
2
- VERSION = '2.3.7'
2
+ VERSION = '2.3.9'
3
3
  end
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.notify_or_ignore exception) if Airbrake.configuration.public?
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 = default_logger
54
- self.configuration_file_path = 'config/rabbit_feed.yml'
55
- self.environment = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
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 specified in the config file' do
121
- expect(subject.application).to eq 'rabbit_feed'
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
- before do
84
- stub_const('Airbrake', double(:airbrake, configuration: airbrake_configuration))
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 'and the Airbrake configuration is public' do
88
- let(:airbrake_configuration) { double(:airbrake_configuration, public?: true) }
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(:notify_or_ignore).with(an_instance_of RuntimeError)
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
- before do
25
- stub_const('Airbrake', double(:airbrake, configuration: airbrake_configuration))
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 'and the Airbrake configuration is public' do
29
- let(:airbrake_configuration) { double(:airbrake_configuration, public?: true) }
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(:notify_or_ignore).with(an_instance_of ReturnedMessageError)
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.local(1990)) do
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.7
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-01-21 00:00:00.000000000 Z
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny