Browse files

Make the tests pass again

  • Loading branch information...
1 parent fb61bb3 commit c5c525e9053e0520fe1e0ef52201cc0c60cb0508 @rking rking committed with rking@sharpsaw.org Jan 6, 2013
Showing with 5 additions and 2 deletions.
  1. +2 −1 lib/pry-rescue/core_ext.rb
  2. +3 −1 spec/core_ext_spec.rb
View
3 lib/pry-rescue/core_ext.rb
@@ -37,7 +37,8 @@ def rescued(e=$!)
if i = (@raised || []).index{ |(ee, _)| ee == e }
PryRescue.enter_exception_context(@raised[0..i])
else
- stack = "\n" + e.backtrace.join("\n")
+ stack = ''
+ stack = "\n" + e.backtrace.join("\n") if e.backtrace
case e
when SystemStackError
# Interception cannot reliably interept SystemStackErrors as it needs
View
4 spec/core_ext_spec.rb
@@ -107,7 +107,9 @@
it "should raise an error if used on an exception not raised" do
Pry::rescue do
- Pry.should_receive(:warn).with("WARNING: Tried to inspect an exception that was not raised within Pry::rescue{ }")
+ Pry.should_receive(:warn) do |message|
+ message.should =~ /^WARNING: Tried to inspect exception outside of Pry::rescue/
+ end
Pry.rescued(RuntimeError.new("foo").exception)
end
end

0 comments on commit c5c525e

Please sign in to comment.