Sha256: dc03f0b748847740d37b326c73945c37af2cf23d42f4fef5a96253e2b958f4c8

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require File.expand_path("../../spec_helper", File.dirname(__FILE__))

describe Sprinkle::Actors::Local do

  before do
    @local = Sprinkle::Actors::Local.new
    
    @package = Package.new("super") {}
  end

  describe 'when installing' do

    before do
      @installer = Sprinkle::Installers::Runner.new(@package, "echo hi")
      @commands = %w( op1 op2 )
      @roles    = %w( app )
      @name     = 'name'

      @local.stub(:run_command).and_return(0)
    end

    it 'should run the commands on the local system' do
      @local.should_receive(:run_command).once.and_return(0)
      @local.install @installer, @roles
    end

  end
  
  describe 'when verifying' do
    
    before do
      @verifier = Sprinkle::Verify::new(@package) {}
      @verifier.commands.concat ["test","test"]
      @roles    = %w( app )
      @name     = 'name'
    end
    
    it 'should return false when verification fails' do
      @local.stub(:run_command).and_return(1)
      res = @local.verify @verifier, @roles
      res.should == false
    end

    it 'should run the commands on the local system' do
      @local.stub(:run_command).and_return(0)
      res = @local.verify @verifier, @roles
      res.should == true
    end
    
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sprinkle-0.7.7 spec/sprinkle/actors/local_spec.rb