From 560a6cbd7982e0791db8e99e774e66cda3c93c6b Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 13 Dec 2011 23:09:14 -0800 Subject: [PATCH] Ensure show-method -h works in ruby-1.9.2 [fixes #374] --- lib/pry/helpers/options_helpers.rb | 2 +- test/test_default_commands/test_introspection.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pry/helpers/options_helpers.rb b/lib/pry/helpers/options_helpers.rb index 437e18bc..9a02989e 100644 --- a/lib/pry/helpers/options_helpers.rb +++ b/lib/pry/helpers/options_helpers.rb @@ -22,7 +22,7 @@ class Pry yield opt opt.on :h, :help, "This message" do - output.puts opt + output.puts opt.to_s throw :command_done end end diff --git a/test/test_default_commands/test_introspection.rb b/test/test_default_commands/test_introspection.rb index 556e01ae..bcaa16c4 100644 --- a/test/test_default_commands/test_introspection.rb +++ b/test/test_default_commands/test_introspection.rb @@ -254,6 +254,10 @@ describe "Pry::DefaultCommands::Introspection" do str_output.string.should =~ /def sample/ end + it 'should output help' do + mock_pry('show-method -h').should =~ /Usage: show-method/ + end + it 'should output a method\'s source with line numbers' do str_output = StringIO.new redirect_pry_io(InputTester.new("show-method -l sample_method", "exit-all"), str_output) do