mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Use pry_eval to test show-doc on commands
This commit is contained in:
parent
46e1196e75
commit
90b3f807f0
2 changed files with 4 additions and 6 deletions
|
@ -309,7 +309,6 @@ if !mri18_and_no_real_source_location?
|
|||
end
|
||||
|
||||
describe "on commands" do
|
||||
|
||||
# mostly copied & modified from test_help.rb
|
||||
before do
|
||||
@oldset = Pry.config.commands
|
||||
|
@ -323,19 +322,18 @@ if !mri18_and_no_real_source_location?
|
|||
end
|
||||
|
||||
it 'should display help for a specific command' do
|
||||
mock_pry('show-doc ls').should =~ /Usage: ls/
|
||||
pry_eval('show-doc ls').should =~ /Usage: ls/
|
||||
end
|
||||
|
||||
it 'should display help for a regex command with a "listing"' do
|
||||
@set.command /bar(.*)/, "Test listing", :listing => "foo" do; end
|
||||
mock_pry('show-doc foo').should =~ /Test listing/
|
||||
pry_eval('show-doc foo').should =~ /Test listing/
|
||||
end
|
||||
|
||||
it 'should display help for a command with a spaces in its name' do
|
||||
@set.command "command with spaces", "description of a command with spaces" do; end
|
||||
mock_pry('show-doc "command with spaces"').should =~ /description of a command with spaces/
|
||||
pry_eval('show-doc "command with spaces"').should =~ /description of a command with spaces/
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ require 'helper'
|
|||
# for C methods actually runs the methods - and since it runs ALL
|
||||
# methods (in an attempt to find a match) it runs 'exit' and aborts
|
||||
# the test, causing a failure. We should fix this in the future by
|
||||
# blacklisting certain methods for 1.8 MRI (such as exit, fork, and so on)
|
||||
# blacklisting certain methods for 1.8 MRI (such as exit, fork, and so on)
|
||||
unless Pry::Helpers::BaseHelpers.mri_18?
|
||||
MyKlass = Class.new do
|
||||
def hello
|
||||
|
|
Loading…
Add table
Reference in a new issue