2011-09-19 01:13:34 -04:00
|
|
|
require 'helper'
|
|
|
|
|
|
|
|
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
|
|
|
|
Pry.config.exception_whitelist.include?(NameError).should == false
|
2012-06-11 09:36:16 -04:00
|
|
|
lambda { Pry.start(self, :input => StringIO.new("raise NameError\nexit"), :output => @str_output) }.should.not.raise NameError
|
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]
|
2012-06-11 09:36:16 -04:00
|
|
|
lambda { Pry.start(self, :input => StringIO.new("raise NameError"), :output => @str_output) }.should.raise NameError
|
2011-09-19 01:13:34 -04:00
|
|
|
Pry.config.exception_whitelist = old_whitelist
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|