From cb65c26b9e18a9e850dc4bb6a106943c0f7722bf Mon Sep 17 00:00:00 2001 From: John Mair Date: Sat, 17 Dec 2011 18:57:42 +1300 Subject: [PATCH] fixed ls -h and added test --- lib/pry/default_commands/ls.rb | 2 +- test/test_default_commands/test_ls.rb | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/pry/default_commands/ls.rb b/lib/pry/default_commands/ls.rb index 3daa7f40..0409342a 100644 --- a/lib/pry/default_commands/ls.rb +++ b/lib/pry/default_commands/ls.rb @@ -143,7 +143,7 @@ class Pry opt.on :h, "help", "Show help" end - next output.puts(opts) if opts.present?(:help) + next output.puts(opts.to_s) if opts.present?(:help) obj = args.empty? ? target_self : target.eval(args.join(" ")) diff --git a/test/test_default_commands/test_ls.rb b/test/test_default_commands/test_ls.rb index 3e269b58..427d1f9c 100644 --- a/test/test_default_commands/test_ls.rb +++ b/test/test_default_commands/test_ls.rb @@ -22,7 +22,13 @@ describe "ls" do end end - describe "methods" do + describe "help" do + it 'should show help with -h' do + mock_pry("ls -h").should =~ /Usage: ls/ + end + end + + describe "methods" do it "should show public methods by default" do mock_pry("ls Class.new{ def goo; end }.new").should =~ /goo/ end