Sha256: c73d915bdb9beb25bd7ad307ad3bd96eefc87bae681c47fce6b05c86a7f2f27e
Contents?: true
Size: 1.92 KB
Versions: 2
Compression:
Stored size: 1.92 KB
Contents
require File.expand_path("../../spec_helper", File.dirname(__FILE__)) describe Sprinkle::Installers::Runner do before do @package = mock(Sprinkle::Package, :name => 'package', :sudo? => false) end def create_runner(*cmds) options=cmds.extract_options! Sprinkle::Installers::Runner.new(@package, cmds, options) end describe 'when created' do it 'should accept a single cmd to run' do @installer = create_runner 'teste' @installer.cmds.should == ['teste'] end it 'should accept an array of commands to run' do @installer = create_runner ['teste', 'world'] @installer.cmds.should == ['teste', 'world'] @installer.install_sequence.should == ['teste', 'world'] end end describe 'during installation' do it 'should use sudo if specified locally' do @installer = create_runner 'teste', :sudo => true @install_commands = @installer.send :install_commands @install_commands.should == ['sudo teste'] end it "should accept env options and convert to uppercase" do @installer = create_runner 'command1', :env => { :z => 'foo', :PATH => '/some/path', :user => 'deploy', :a => 'bar' } @install_commands = @installer.send :install_commands command_parts = @install_commands.first.split(/ /) command_parts.shift.should == 'env' command_parts.pop.should == 'command1' command_parts.should =~ ['PATH=/some/path', 'USER=deploy', 'Z=foo', 'A=bar'] end it "should accept multiple commands" do @installer = create_runner 'teste', 'test2' @install_commands = @installer.send :install_commands @install_commands.should == ['teste','test2'] end it 'should run the given command for all specified packages' do @installer = create_runner 'teste' @install_commands = @installer.send :install_commands @install_commands.should == ['teste'] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sprinkle-0.7.4 | spec/sprinkle/installers/runner_spec.rb |
sprinkle-0.7.3 | spec/sprinkle/installers/runner_spec.rb |