Sha256: 83629c5fed115bcfd320ddd978f566f5d377264b0bd63f03a2e465e76d400c49

Contents?: true

Size: 964 Bytes

Versions: 1

Compression:

Stored size: 964 Bytes

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

describe "anywhere mission" do
  before { Bond.agent.reset }

  describe "normally" do
    before { complete(:anywhere=>':[^:\s.]*') {|e| %w{:ab :bd :ae} } }

    it "completes at beginning" do
      tab(":a").should == %w{:ab :ae}
    end

    it "completes in middle of string" do
      tab("hash[:a").should == %w{hash[:ab hash[:ae}
    end

    it "completes after word break chars" do
      tab("{:ab=>1}[:a").should == ["1}[:ab", "1}[:ae"]
      tab("nil;:a").should == %w{:ab :ae}
    end
  end

  it 'with special chars and custom search completes' do
    complete(:anywhere=>'\$[^\s.]*', :search=>false) {|e|
      global_variables.grep(/^#{Regexp.escape(e.matched[1])}/)
    }
    tab("$LO").should == ["$LOAD_PATH", "$LOADED_FEATURES"]
  end

  it 'with :prefix completes' do
    complete(:prefix=>'_', :anywhere=>':[^:\s.]*') { %w{:ab :bd :ae} }
    tab("_:a").should == %w{_:ab _:ae}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bond-0.2.0 test/anywhere_mission_test.rb