1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

added basic tests for exception whitelist

This commit is contained in:
John Mair 2011-09-19 17:13:34 +12:00
parent e85235221b
commit c99bed6c52

View file

@ -0,0 +1,17 @@
require 'helper'
describe "Pry.config.exception_whitelist" do
it 'should rescue all exceptions NOT specified on whitelist' do
Pry.config.exception_whitelist.include?(NameError).should == false
lambda { Pry.start(self, :input => StringIO.new("raise NameError\nexit"), :output => StringIO.new) }.should.not.raise NameError
end
it 'should NOT rescue exceptions specified on whitelist' do
old_whitelist = Pry.config.exception_whitelist
Pry.config.exception_whitelist = [NameError]
lambda { Pry.start(self, :input => StringIO.new("raise NameError"), :output => StringIO.new) }.should.raise NameError
Pry.config.exception_whitelist = old_whitelist
end
end