Sha256: aeb7f4fa8f085ba149fc104631e6c4351bf1dd241a30751c58d7e60f6b342f69

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

require File.expand_path('../../test_helper', __FILE__)

describe "Kicker, concerning the `execute a command-line' callback" do
  it "should parse the command and add the callback" do
    before = Kicker.pre_process_chain.length
    
    Kicker::Options.parse(%w{ -e ls })
    Kicker.pre_process_chain.length.should == before + 1
    
    Kicker::Options.parse(%w{ --execute ls })
    Kicker.pre_process_chain.length.should == before + 2
  end
  
  it "should call execute with the given command" do
    Kicker::Options.parse(%w{ -e ls })
    
    callback = Kicker.pre_process_chain.last
    callback.should.be.instance_of Proc
    
    Kicker::Utils.expects(:execute).with('sh -c "ls"')
    
    callback.call(%w{ /file/1 /file/2 }).should.not.be.instance_of Array
  end
  
  it "should clear the files array to halt the chain" do
    Kicker::Utils.stubs(:execute)
    
    files = %w{ /file/1 /file/2 }
    Kicker.pre_process_chain.last.call(files)
    files.should.be.empty
  end
  
  it "should run the command directly once Kicker is done loading" do
    callback = Kicker.pre_process_chain.last
    Kicker.startup_chain.should.include callback
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kicker-2.4.0 test/recipes/execute_cli_command_test.rb
kicker-2.3.1 test/recipes/execute_cli_command_test.rb
kicker-2.3.0 test/recipes/execute_cli_command_test.rb
kicker-2.2.3 test/recipes/execute_cli_command_test.rb
kicker-2.2.2 test/recipes/execute_cli_command_test.rb
kicker-2.2.1 test/recipes/execute_cli_command_test.rb
kicker-2.2.0 test/recipes/execute_cli_command_test.rb