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

22 lines
737 B
Ruby
Raw Normal View History

require_relative 'helper'
describe "Pry.config.exception_whitelist" do
before do
@str_output = StringIO.new
end
it 'should rescue all exceptions NOT specified on whitelist' do
2015-01-22 16:52:20 -05:00
Pry.config.exception_whitelist.include?(NameError).should eq false
expect { Pry.start(self, :input => StringIO.new("raise NameError\nexit"), :output => @str_output) }.not_to raise_error
end
it 'should NOT rescue exceptions specified on whitelist' do
old_whitelist = Pry.config.exception_whitelist
Pry.config.exception_whitelist = [NameError]
expect { Pry.start(self, :input => StringIO.new("raise NameError"), :output => @str_output) }.to raise_error NameError
Pry.config.exception_whitelist = old_whitelist
end
end