Browse files

Rely on nil check in Pry.rescued [Closes #31]

Post recent refactoring, it should not be possible for
enter_exception_context to be called with an invalid exception.

`rake sintax` now does this: http://showterm.io/b4b797cf4e4676223936e
  • Loading branch information...
1 parent 8158b81 commit aa53c8d36e55c5d268359e4b696fae89432d2b11 @ConradIrwin committed Mar 21, 2013
Showing with 4 additions and 6 deletions.
  1. +0 −1 lib/pry-rescue.rb
  2. +4 −5 spec/pry_rescue_spec.rb
View
1 lib/pry-rescue.rb
@@ -165,7 +165,6 @@ def without_bindings_below_raise(bindings)
# @param [Array<Bindings>] bindings The call stack
# @return [Array<Bindings>]
def without_duplicates(bindings)
- bindings = Array(bindings)
bindings.zip([nil] + bindings).reject do |b, c|
# The eval('__method__') is there as a shortcut as loading a method
# from a binding is very slow.
View
9 spec/pry_rescue_spec.rb
@@ -96,11 +96,10 @@
}.should raise_error(/raiseother_exception/)
end
- it "should work if bindings is nil" do
- PryRescue.stub(:without_bindings_below_raise).and_return nil
- PryRescue.stub(:phantom_load_raise?).and_return false
- PryRescue.stub(:with_program_name).and_return nil
- PryRescue.enter_exception_context [:hi]
+ it "should output a warning if the exception was not raised" do
+ PryRescue.should_not_receive(:enter_exception_context)
+ Pry.should_receive(:warn).once
+ Pry.rescued(RuntimeError.new("foo"))
end
else
it "should open at the correct point" do

0 comments on commit aa53c8d

Please sign in to comment.