Sha256: 2e6bb2c4058e30b585124bc29a84acea4814299abdbc7f7d7a89f3f6e4c47376

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

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

class BondTest < Test::Unit::TestCase
  context "debrief" do
    before(:each) {|e| Bond.instance_eval("@agent = @config = nil")}
    test "prints error if readline_plugin is not a module" do
      capture_stderr { Bond.debrief :readline_plugin=>false }.should =~ /Invalid/
    end
    
    test "prints error if readline_plugin doesn't have all required methods" do
      capture_stderr {Bond.debrief :readline_plugin=>Module.new{ def setup; end } }.should =~ /Invalid/
    end

    test "prints no error if valid readline_plugin" do
      capture_stderr {Bond.debrief :readline_plugin=>valid_readline_plugin }.should == ''
    end

    test "sets default mission" do
      default_mission = lambda { %w{1 2 3}}
      Bond.reset
      Bond.debrief :default_mission=>default_mission, :readline_plugin=>valid_readline_plugin
      tabtab('1').should == ['1']
    end

    test "sets default search" do
      Bond.reset
      Bond.debrief :default_search=>:underscore
      complete(:method=>'blah') { %w{all_quiet on_the western_front}}
      tabtab('blah a-q').should == ["all_quiet"]
      Bond.reset
    end
  end

  test "reset clears existing missions" do
    complete(:on=>/blah/) {[]}
    Bond.agent.missions.size.should_not == 0
    Bond.reset
    Bond.agent.missions.size.should == 0
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
cldwalker-bond-0.1.4 test/bond_test.rb
bond-0.1.4 test/bond_test.rb