1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Tolerate Bond not being present

This commit is contained in:
Ryan Fitzgerald 2012-09-05 22:39:29 -07:00
parent c9fed62c91
commit f0a16e2cc3
3 changed files with 26 additions and 20 deletions

View file

@ -696,17 +696,19 @@ describe "Pry::Command" do
end
end
describe 'complete' do
it 'should return the arguments that are defined' do
@set.create_command "torrid" do
def options(opt)
opt.on :test
opt.on :lest
opt.on :pests
if defined?(Bond)
describe 'complete' do
it 'should return the arguments that are defined' do
@set.create_command "torrid" do
def options(opt)
opt.on :test
opt.on :lest
opt.on :pests
end
end
end
@set.complete('torrid ').should.include('--test')
@set.complete('torrid ').should.include('--test')
end
end
end

View file

@ -611,15 +611,17 @@ describe Pry::CommandSet do
end
end
describe '.complete' do
it "should list all command names" do
@set.create_command('susan'){ }
@set.complete('sus').should.include 'susan'
end
if defined?(Bond)
describe '.complete' do
it "should list all command names" do
@set.create_command('susan'){ }
@set.complete('sus').should.include 'susan'
end
it "should delegate to commands" do
@set.create_command('susan'){ def complete(search); ['--foo']; end }
@set.complete('susan ').should == ['--foo']
it "should delegate to commands" do
@set.create_command('susan'){ def complete(search); ['--foo']; end }
@set.complete('susan ').should == ['--foo']
end
end
end
end

View file

@ -10,9 +10,11 @@ def completer_test(bind, pry=nil, assert_flag=true)
return proc {|*symbols| symbols.each(&test) }
end
describe 'bond-based completion' do
it 'should pull in Bond by default' do
Pry.config.completer.should == Pry::BondCompleter
if defined?(Bond)
describe 'bond-based completion' do
it 'should pull in Bond by default' do
Pry.config.completer.should == Pry::BondCompleter
end
end
end