Permalink
Browse files

Do not skip Dir.pwd frames, re: #20

  • Loading branch information...
1 parent c5c525e commit e808e09c67641224ef53c0d78a5b552eb7eb9cbc @rking rking committed with rking@sharpsaw.org Jan 7, 2013
Showing with 9 additions and 1 deletion.
  1. +2 −0 lib/pry-rescue.rb
  2. +1 −1 pry-rescue.gemspec
  3. +6 −0 spec/pry_rescue_spec.rb
View
@@ -104,6 +104,8 @@ def initial_frame(bindings)
# @param [String] file the absolute path
# @return [Boolean]
def user_path?(file)
+ return false if file.match(%r(/vendor/))
+ return true if file.match(Dir.pwd)
!file.start_with?(RbConfig::CONFIG['libdir']) &&
!gem_path?(file) &&
!%w( (eval) <internal:prelude> ).include?(file)
View
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'pry-rescue'
- s.version = '0.14'
+ s.version = '0.15'
s.summary = 'Open a pry session on any unhandled exceptions'
s.description = 'Allows you to wrap code in Pry::rescue{ } to open a pry session at any unhandled exceptions'
s.homepage = 'https://github.com/ConradIrwin/pry-rescue'
View
@@ -52,6 +52,12 @@
}.should raise_error(ArgumentError)
end
+ it "should skip pwd, even if it is a gem (but not vendor stuff)" do
+ Gem::Specification.stub :any? do true end
+ PryRescue.send(:user_path?, Dir.pwd + '/asdf.rb').should be_true
+ PryRescue.send(:user_path?, Dir.pwd + '/vendor/asdf.rb').should be_false
+ end
+
it "should filter out duplicate stack frames" do
PryRescue.should_receive(:pry).once do |opts|
opts[:call_stack][0].eval("__LINE__").should == 4

0 comments on commit e808e09

Please sign in to comment.