-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change exception handler to be pluggable
- Loading branch information
Takashi Kokubun
committed
Sep 30, 2016
1 parent
c04b386
commit bd828aa
Showing
4 changed files
with
36 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'rails_helper' | ||
require 'barbeque/exception_handler' | ||
|
||
describe Barbeque::ExceptionHandler do | ||
describe '.handle_exception' do | ||
let(:exception) do | ||
StandardError.new('something went wrong').tap do |e| | ||
e.set_backtrace(['barbeque.rb:1']) | ||
end | ||
end | ||
let(:handler) { 'RailsLogger' } | ||
|
||
before do | ||
allow(Barbeque).to receive_message_chain(:config, :exception_handler).and_return(handler) | ||
end | ||
|
||
it 'handles exception with configured handler' do | ||
expect(Barbeque::ExceptionHandler::RailsLogger).to receive(:handle_exception).with(exception) | ||
Barbeque::ExceptionHandler.handle_exception(exception) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
default: &default | ||
exception_handler: rails_logger | ||
exception_handler: RailsLogger | ||
runner: Docker | ||
|
||
development: | ||
|