airbrake 5.4.1 → 5.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,11 +8,21 @@ RSpec.describe "Rails integration specs" do
8
8
 
9
9
  include_examples 'rack examples'
10
10
 
11
- it "inserts the Airbrake Rack middleware after DebugExceptions" do
12
- middlewares = Rails.configuration.middleware.middlewares.map(&:inspect)
13
- own_idx = middlewares.index('Airbrake::Rack::Middleware')
11
+ if ::Rails.version.start_with?('5.')
12
+ it "inserts the Airbrake Rack middleware after DebugExceptions" do
13
+ middlewares = Rails.configuration.middleware.middlewares.map(&:inspect)
14
+ own_idx = middlewares.index('Airbrake::Rack::Middleware')
14
15
 
15
- expect(middlewares[own_idx - 1]).to eq('ActionDispatch::DebugExceptions')
16
+ expect(middlewares[own_idx - 1]).to eq('ActionDispatch::DebugExceptions')
17
+ end
18
+ else
19
+ it "inserts the Airbrake Rack middleware after ConnectionManagement" do
20
+ middlewares = Rails.configuration.middleware.middlewares.map(&:inspect)
21
+ own_idx = middlewares.index('Airbrake::Rack::Middleware')
22
+
23
+ expect(middlewares[own_idx - 1]).
24
+ to eq('ActiveRecord::ConnectionAdapters::ConnectionManagement')
25
+ end
16
26
  end
17
27
 
18
28
  shared_examples 'context payload content' do |route|
@@ -1,4 +1,6 @@
1
+ require 'sinatra'
1
2
  require 'spec_helper'
3
+ require 'apps/sinatra/dummy_app'
2
4
  require 'integration/shared_examples/rack_examples'
3
5
 
4
6
  RSpec.describe "Sinatra integration specs" do
@@ -7,11 +7,6 @@ require 'rack'
7
7
  require 'rack/test'
8
8
  require 'rake'
9
9
 
10
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.0')
11
- require 'sidekiq'
12
- require 'sidekiq/cli'
13
- end
14
-
15
10
  require 'airbrake'
16
11
  require 'airbrake/rake/tasks'
17
12
 
@@ -69,20 +64,11 @@ if ENV['APPRAISAL_INITIALIZED']
69
64
  puts '** Skipped Rails specs'
70
65
  end
71
66
 
72
- # Load a Sinatra app or skip.
73
- begin
74
- # Resque depends on Sinatra, so when we launch Rails specs, we also
75
- # accidentally load Sinatra.
76
- raise LoadError if defined?(Resque)
77
-
78
- require 'sinatra'
79
- require 'apps/sinatra/dummy_app'
80
- rescue LoadError
81
- puts '** Skipped Sinatra specs'
82
- end
83
-
84
67
  # Load a Rack app or skip.
85
68
  begin
69
+ # Don't load the Rack app since we want to test Sinatra if it's loaded.
70
+ raise LoadError if defined?(Sinatra)
71
+
86
72
  require 'apps/rack/dummy_app'
87
73
  rescue LoadError
88
74
  puts '** Skipped Rack specs'
@@ -120,7 +106,6 @@ versions = <<EOS
120
106
  EOS
121
107
  versions << "# JRUBY_VERSION #{JRUBY_VERSION}\n" if defined?(JRUBY_VERSION)
122
108
  versions << "# Rails version: #{Rails.version}\n" if defined?(Rails)
123
- versions << "# Sinatra version: #{Sinatra::VERSION}\n" if defined?(Sinatra)
124
109
  versions << "# Rack release: #{Rack.release}\n"
125
110
  versions << '#' * 80
126
111
 
@@ -36,4 +36,32 @@ RSpec.describe "airbrake/rake/tasks" do
36
36
  include_examples 'deploy payload', key, val
37
37
  end
38
38
  end
39
+
40
+ describe "airbrake:install_heroku_deploy_hook" do
41
+ let(:task) { Rake::Task['airbrake:install_heroku_deploy_hook'] }
42
+
43
+ after { task.reenable }
44
+
45
+ let(:airbrake_vars) { "AIRBRAKE_PROJECT_ID=1\nAIRBRAKE_API_KEY=2\nRAILS_ENV=3\n" }
46
+ let(:silenced_stdout) { File.new(File::NULL, 'w') }
47
+
48
+ before do
49
+ @original_stdout = $stdout
50
+ $stdout = silenced_stdout
51
+ end
52
+
53
+ after do
54
+ $stdout.close
55
+ $stdout = @original_stdout
56
+ end
57
+
58
+ describe "parsing environment variables" do
59
+ it "does not raise when an env variable value contains '='" do
60
+ heroku_config = airbrake_vars + "URL=https://airbrake.io/docs?key=11\n"
61
+ expect(Bundler).to receive(:with_clean_env).twice.and_return(heroku_config)
62
+
63
+ task.invoke
64
+ end
65
+ end
66
+ end
39
67
  end
@@ -1,6 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.0')
4
+ require 'sidekiq'
5
+ require 'sidekiq/cli'
6
+ require 'airbrake/sidekiq/error_handler'
7
+
4
8
  RSpec.describe "airbrake/sidekiq/error_handler" do
5
9
  let(:endpoint) do
6
10
  'https://airbrake.io/api/v3/projects/113743/notices?key=fd04e13d806a90f96614ad8e529b2822'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.1
4
+ version: 5.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-21 00:00:00.000000000 Z
11
+ date: 2016-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airbrake-ruby
@@ -187,6 +187,11 @@ files:
187
187
  - spec/apps/rack/dummy_app.rb
188
188
  - spec/apps/rails/dummy_app.rb
189
189
  - spec/apps/rails/dummy_task.rake
190
+ - spec/apps/rails/logs/32.log
191
+ - spec/apps/rails/logs/41.log
192
+ - spec/apps/rails/logs/42.log
193
+ - spec/apps/rails/logs/50.log
194
+ - spec/apps/rails/logs/51.log
190
195
  - spec/apps/sinatra/dummy_app.rb
191
196
  - spec/integration/rack/rack_spec.rb
192
197
  - spec/integration/rails/rails_spec.rb
@@ -229,6 +234,11 @@ test_files:
229
234
  - spec/apps/rack/dummy_app.rb
230
235
  - spec/apps/rails/dummy_app.rb
231
236
  - spec/apps/rails/dummy_task.rake
237
+ - spec/apps/rails/logs/32.log
238
+ - spec/apps/rails/logs/41.log
239
+ - spec/apps/rails/logs/42.log
240
+ - spec/apps/rails/logs/50.log
241
+ - spec/apps/rails/logs/51.log
232
242
  - spec/apps/sinatra/dummy_app.rb
233
243
  - spec/integration/rack/rack_spec.rb
234
244
  - spec/integration/rails/rails_spec.rb
@@ -241,3 +251,4 @@ test_files:
241
251
  - spec/unit/rack/user_spec.rb
242
252
  - spec/unit/rake/tasks_spec.rb
243
253
  - spec/unit/sidekiq/error_handler_spec.rb
254
+ has_rdoc: