Sha256: ddfff01a492afa0082a7e827a5459a322408183ba04d2e7716e2f228f54dec19

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

# Encoding: utf-8
require 'spec_helper'

RSpec.describe Packer::Provisioner::Ansible do
  let(:provisioner) do
    Packer::Provisioner.get_provisioner('ansible-local')
  end

  let(:some_string) do
    'some string'
  end

  let(:some_array_of_strings) do
    %w[commmand1 command2]
  end

  let(:some_array_of_ints) do
    [1, 2, 3]
  end

  let(:some_hash_of_strings) do
    {a: 'foo', b: 'bar'}
  end

  it 'requires a playbook_file setting' do
    expect{ provisioner.validate }.to raise_error
  end

  describe '#initialize' do
    it 'has a type of ansible-local' do
      expect(provisioner.data['type']).to eq('ansible-local')
    end
  end

  describe '#playbook_file' do
    it 'accepts a string' do
      provisioner.playbook_file some_string
      expect(provisioner.data['playbook_file']).to eq(some_string)
      provisioner.data.delete('playbook_file')
    end

    it 'converts any argument passed to a string' do
      provisioner.playbook_file some_array_of_ints
      expect(provisioner.data['playbook_file']).to eq(some_array_of_ints.to_s)
      provisioner.data.delete('playbook_file')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
packer-config-1.6.0 spec/packer/provisioners/ansible_spec.rb
packer-config-1.5.0 spec/packer/provisioners/ansible_spec.rb
packer-config-1.4.0 spec/packer/provisioners/ansible_spec.rb
packer-config-1.3.1 spec/packer/provisioners/ansible_spec.rb
packer-config-1.3.0 spec/packer/provisioners/ansible_spec.rb
packer-config-1.2.0 spec/packer/provisioners/ansible_spec.rb
packer-config-1.1.0 spec/packer/provisioners/ansible_spec.rb
packer-config-1.0.0 spec/packer/provisioners/ansible_spec.rb