summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/pry/commands/pry_backtrace.rb4
-rw-r--r--spec/commands/pry_backtrace_spec.rb12
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/pry/commands/pry_backtrace.rb b/lib/pry/commands/pry_backtrace.rb
index 44b6e3b7..d3a1b86c 100644
--- a/lib/pry/commands/pry_backtrace.rb
+++ b/lib/pry/commands/pry_backtrace.rb
@@ -20,9 +20,7 @@ class Pry
BANNER
def process
- text = bold('Backtrace:')
- text << "\n--\n"
- text << pry_instance.backtrace.join("\n")
+ text = "#{bold('Backtrace:')}\n--\n#{pry_instance.backtrace.join("\n")}"
pry_instance.pager.page(text)
end
end
diff --git a/spec/commands/pry_backtrace_spec.rb b/spec/commands/pry_backtrace_spec.rb
new file mode 100644
index 00000000..320f42f7
--- /dev/null
+++ b/spec/commands/pry_backtrace_spec.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+describe "pry_backtrace" do
+ before do
+ @t = pry_tester
+ end
+
+ it 'should print a backtrace' do
+ @t.process_command 'pry-backtrace'
+ expect(@t.last_output).to start_with('Backtrace:')
+ end
+end