Sha256: 9c99846d0c3374e7b5a772838e769ed446d115fae9cf96c7461870ef356b1306

Contents?: true

Size: 1.81 KB

Versions: 3

Compression:

Stored size: 1.81 KB

Contents

require 'spec_helper'

class ClassMixedWithDSLWrappers
  include Beaker::DSL::Wrappers
end

describe ClassMixedWithDSLWrappers do
  let(:opts)  { {'ENV' => default_opts} }
  let(:default_opts) { Beaker::Command::DEFAULT_GIT_ENV }
  describe '#facter' do
    it 'should split out the options and pass "facter" as first arg to Command' do
      Beaker::Command.should_receive( :new ).
        with('facter', [ '-p' ], opts)
      subject.facter( '-p' )
    end
  end

  describe '#hiera' do
    it 'should split out the options and pass "hiera" as first arg to Command' do
      Beaker::Command.should_receive( :new ).
        with('hiera', [ '-p' ], opts)
      subject.hiera( '-p' )
    end
  end

  describe '#razor' do
    it 'should split out the options and pass "razor" as first arg to Command' do
      Beaker::Command.should_receive( :new ).
        with('razor', [ '-p' ], opts)
      subject.razor( '-p' )
    end
  end

  describe '#puppet' do
    it 'should split out the options and pass "puppet <blank>" to Command' do
      merged_opts = {}
      merged_opts['ENV'] = {:HOME => '/'}.merge( default_opts )
      merged_opts[:server] = 'master'
      Beaker::Command.should_receive( :new ).
        with('puppet agent', [ '-tv' ], merged_opts)
      subject.puppet( 'agent', '-tv', :server => 'master', 'ENV' => {:HOME => '/'})
    end
  end

  describe '#host_command' do
    it 'delegates to HostCommand.new' do
      Beaker::HostCommand.should_receive( :new ).with( 'blah' )
      subject.host_command( 'blah' )
    end
  end

  describe 'deprecated puppet wrappers' do
    %w( resource doc kick cert apply master agent filebucket ).each do |sub|
      it "#{sub} delegates the proper info to #puppet" do
        subject.should_receive( :puppet ).with( sub, 'blah' )
        subject.send( "puppet_#{sub}", 'blah')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
beaker-1.12.1 spec/beaker/dsl/wrappers_spec.rb
beaker-1.12.0 spec/beaker/dsl/wrappers_spec.rb
beaker-1.11.2 spec/beaker/dsl/wrappers_spec.rb