1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/test/test_exception_whitelist.rb
Kyrylo Silin 8f3e4555ba Tidy up tests and remove some repeating code
Clean up repeating code on the subject of str_output variable. Fix
indentation in some files and restructure some tests, in order to
ease parsing of files by an eye.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Signed-off-by: Yorick Peterse <yorickpeterse@gmail.com>
2012-06-11 19:33:04 +02:00

21 lines
734 B
Ruby

require 'helper'
describe "Pry.config.exception_whitelist" do
before do
@str_output = StringIO.new
end
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 => @str_output) }.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 => @str_output) }.should.raise NameError
Pry.config.exception_whitelist = old_whitelist
end
end