diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index 9aa8c6b4..6688d3f8 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -89,7 +89,7 @@ class Pry @indent = Pry::Indent.new @command_state = {} @eval_string = "" - @backtace = options[:backtrace] || caller + @backtrace = options[:backtrace] || caller refresh_config(options) push_initial_binding(options) diff --git a/spec/pry_spec.rb b/spec/pry_spec.rb index c1965c08..de194057 100644 --- a/spec/pry_spec.rb +++ b/spec/pry_spec.rb @@ -428,4 +428,14 @@ describe Pry do } end end + + describe "a fresh instance" do + it "should use `caller` as its backtrace" do + location = "#{__FILE__}:#{__LINE__ + 1}" + backtrace = Pry.new.backtrace + + backtrace.should.not.be.nil + backtrace.any? { |l| l.include?(location) }.should.be.true + end + end end