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
end end
describe 'complete' do if defined?(Bond)
it 'should return the arguments that are defined' do describe 'complete' do
@set.create_command "torrid" do it 'should return the arguments that are defined' do
def options(opt) @set.create_command "torrid" do
opt.on :test def options(opt)
opt.on :lest opt.on :test
opt.on :pests opt.on :lest
opt.on :pests
end
end end
end
@set.complete('torrid ').should.include('--test') @set.complete('torrid ').should.include('--test')
end
end end
end end

View file

@ -611,15 +611,17 @@ describe Pry::CommandSet do
end end
end end
describe '.complete' do if defined?(Bond)
it "should list all command names" do describe '.complete' do
@set.create_command('susan'){ } it "should list all command names" do
@set.complete('sus').should.include 'susan' @set.create_command('susan'){ }
end @set.complete('sus').should.include 'susan'
end
it "should delegate to commands" do it "should delegate to commands" do
@set.create_command('susan'){ def complete(search); ['--foo']; end } @set.create_command('susan'){ def complete(search); ['--foo']; end }
@set.complete('susan ').should == ['--foo'] @set.complete('susan ').should == ['--foo']
end
end end
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) } return proc {|*symbols| symbols.each(&test) }
end end
describe 'bond-based completion' do if defined?(Bond)
it 'should pull in Bond by default' do describe 'bond-based completion' do
Pry.config.completer.should == Pry::BondCompleter it 'should pull in Bond by default' do
Pry.config.completer.should == Pry::BondCompleter
end
end end
end end