2014-03-14 00:31:24 -04:00
|
|
|
require_relative 'helper'
|
2011-09-19 01:13:34 -04:00
|
|
|
|
|
|
|
describe "Pry.config.exception_whitelist" do
|
2012-06-11 09:36:16 -04:00
|
|
|
before do
|
|
|
|
@str_output = StringIO.new
|
|
|
|
end
|
|
|
|
|
2011-09-19 01:13:34 -04:00
|
|
|
it 'should rescue all exceptions NOT specified on whitelist' do
|
2015-03-10 16:49:29 -04:00
|
|
|
expect(Pry.config.exception_whitelist.include?(NameError)).to eq false
|
2018-10-12 15:09:29 -04:00
|
|
|
expect { Pry.start(self, input: StringIO.new("raise NameError\nexit"), output: @str_output) }.not_to raise_error
|
2011-09-19 01:13:34 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should NOT rescue exceptions specified on whitelist' do
|
|
|
|
old_whitelist = Pry.config.exception_whitelist
|
|
|
|
Pry.config.exception_whitelist = [NameError]
|
2018-10-12 15:09:29 -04:00
|
|
|
expect { Pry.start(self, input: StringIO.new("raise NameError"), output: @str_output) }.to raise_error NameError
|
2011-09-19 01:13:34 -04:00
|
|
|
Pry.config.exception_whitelist = old_whitelist
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|