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:
parent
e85235221b
commit
c99bed6c52
1 changed files with 17 additions and 0 deletions
17
test/test_exception_whitelist.rb
Normal file
17
test/test_exception_whitelist.rb
Normal 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
|
||||
|
||||
|
Loading…
Reference in a new issue