Skip to content

Commit

Permalink
Merge pull request airbrake#734 from airbrake/fix-build
Browse files Browse the repository at this point in the history
Fix build
  • Loading branch information
kyrylo authored May 8, 2017
2 parents 984c632 + 778d95c commit 5a57f9a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 31 deletions.
18 changes: 6 additions & 12 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ test:
1) rvm-exec 2.1.10 bundle exec appraisal rails-4.0 rake spec:integration:rails ;;
2) rvm-exec 2.2.7 bundle exec appraisal rails-4.0 rake spec:integration:rails ;;
3) rvm-exec 2.3.4 bundle exec appraisal rails-4.0 rake spec:integration:rails ;;
4) rvm-exec 2.4.1 bundle exec appraisal rails-4.0 rake spec:integration:rails ;;
5)
export JRUBY_OPTS="--dev -Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -Xcompile.mode=OFF"
rvm-exec jruby-9.1.8.0 bundle exec appraisal rails-4.0 rake spec:integration:rails
Expand All @@ -88,7 +87,6 @@ test:
1) rvm-exec 2.1.10 bundle exec appraisal rails-4.1 rake spec:integration:rails ;;
2) rvm-exec 2.2.7 bundle exec appraisal rails-4.1 rake spec:integration:rails ;;
3) rvm-exec 2.3.4 bundle exec appraisal rails-4.1 rake spec:integration:rails ;;
4) rvm-exec 2.4.1 bundle exec appraisal rails-4.1 rake spec:integration:rails ;;
5)
export JRUBY_OPTS="--dev -Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -Xcompile.mode=OFF"
rvm-exec jruby-9.1.8.0 bundle exec appraisal rails-4.1 rake spec:integration:rails
Expand All @@ -115,19 +113,15 @@ test:
2) rvm-exec 2.2.7 bundle exec appraisal rails-5.0 rake spec:integration:rails ;;
3) rvm-exec 2.3.4 bundle exec appraisal rails-5.0 rake spec:integration:rails ;;
4) rvm-exec 2.4.1 bundle exec appraisal rails-5.0 rake spec:integration:rails ;;
5)
export JRUBY_OPTS="--dev -Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -Xcompile.mode=OFF"
rvm-exec jruby-9.1.8.0 bundle exec appraisal rails-5.0 rake spec:integration:rails
;;
esac
:
parallel: true
- ? |
case $CIRCLE_NODE_INDEX in
4) rvm-exec 2.4.1 bundle exec appraisal rails-edge rake spec:integration:rails ;;
esac
:
parallel: true
# - ? |
# case $CIRCLE_NODE_INDEX in
# 4) rvm-exec 2.4.1 bundle exec appraisal rails-edge rake spec:integration:rails ;;
# esac
# :
# parallel: true
- ? |
case $CIRCLE_NODE_INDEX in
0) rvm-exec 2.0.0-p645 bundle exec appraisal sinatra rake spec:integration:sinatra ;;
Expand Down
2 changes: 1 addition & 1 deletion lib/airbrake/delayed_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Airbrake < ::Delayed::Plugin
params[:active_job] = job.payload_object.job_data
end

Airbrake.notify(exception, params) do |notice|
::Airbrake.notify(exception, params) do |notice|
notice[:context][:component] = 'delayed_job'
notice[:context][:action] = job.payload_object.class.name
end
Expand Down
4 changes: 1 addition & 3 deletions lib/airbrake/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ class AirbrakeLogger < SimpleDelegator
attr_accessor :airbrake_notifier

##
# @example
# logger.airbrake_level = Logger::FATAL
# @return [Integer]
attr_accessor :airbrake_level
attr_reader :airbrake_level

def initialize(logger)
__setobj__(logger)
Expand Down
6 changes: 4 additions & 2 deletions lib/airbrake/rails/action_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ module ActionController
# Attaches information from the Rack env.
# @see Airbrake#notify, #notify_airbrake_sync
def notify_airbrake(exception, params = {}, notifier_name = :default)
Airbrake[notifier_name].notify(exception, params)
return unless (notice = build_notice(exception, params, notifier_name))
Airbrake[notifier_name].notify(notice, params)
end

##
# A helper method for sending notices to Airbrake *synchronously*.
# Attaches information from the Rack env.
# @see Airbrake#notify_sync, #notify_airbrake
def notify_airbrake_sync(exception, params = {}, notifier_name = :default)
Airbrake[notifier_name].notify_sync(exception, params)
return unless (notice = build_notice(exception, params, notifier_name))
Airbrake[notifier_name].notify_sync(notice, params)
end

##
Expand Down
2 changes: 1 addition & 1 deletion lib/airbrake/resque.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Failure
# @see https://github.com/resque/resque/wiki/Failure-Backends
class Airbrake < Base
def save
Airbrake.notify_sync(exception, payload) do |notice|
::Airbrake.notify_sync(exception, payload) do |notice|
notice[:context][:component] = 'resque'
notice[:context][:action] = payload['class'].to_s
end
Expand Down
28 changes: 16 additions & 12 deletions spec/integration/rails/rails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,22 @@
end

context "when Airbrake is not configured" do
it "doesn't report errors" do
allow(Airbrake).to receive(:build_notice).and_return(nil)
allow(Airbrake).to receive(:notify)
before do
@notifiers = Airbrake.instance_variable_get(:@notifiers)
@default_notifier = @notifiers.delete(:default)
end

after do
@notifiers[:default] = @default_notifier
end

it "doesn't report errors" do
with_resque { get '/resque' }

wait_for(
a_request(:post, endpoint).
with(body: /"message":"resque error"/)
).not_to have_been_made

expect(Airbrake).to have_received(:build_notice)
expect(Airbrake).not_to have_received(:notify)
end
end
end
Expand All @@ -224,12 +227,16 @@
before do
# Make sure the Logger intergration doesn't get in the way.
allow_any_instance_of(Logger).to receive(:airbrake_notifier).and_return(nil)

@notifiers = Airbrake.instance_variable_get(:@notifiers)
@default_notifier = @notifiers.delete(:default)
end

it "doesn't report errors" do
allow(Airbrake).to receive(:build_notice).and_return(nil)
allow(Airbrake).to receive(:notify)
after do
@notifiers[:default] = @default_notifier
end

it "doesn't report errors" do
# Make sure we don't call `build_notice` more than 1 time. Rack
# integration will try to handle error 500 and we want to prevent
# that: https://github.com/airbrake/airbrake/pull/583
Expand All @@ -245,9 +252,6 @@
a_request(:post, endpoint).
with(body: /"message":"delayed_job error"/)
).not_to have_been_made

expect(Airbrake).to have_received(:build_notice)
expect(Airbrake).not_to have_received(:notify)
end
end
end
Expand Down

0 comments on commit 5a57f9a

Please sign in to comment.