Commit 688c9dbe authored by Mickaël Canévet's avatar Mickaël Canévet
Browse files

Add acceptance test

parent 2b386877
Loading
Loading
Loading
Loading
+25 −0
Changes for spec/acceptance/postfix_spec.rb: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
require 'spec_helper_acceptance'

describe 'postfix class' do

  context 'default parameters' do
    it 'should work idempotently with no errors' do
      pp = <<-EOS
        class { 'postfix': }
      EOS

      # Run it twice and test for idempotency
      apply_manifest(pp, :catch_failures => true)
      apply_manifest(pp, :catch_changes  => true)
    end

    describe package('postfix') do
      it { is_expected.to be_installed }
    end

    describe service('postfix') do
      it { is_expected.to be_enabled }
      it { is_expected.to be_running }
    end
  end
end
+29 −0
Changes for spec/spec_helper_acceptance.rb: 29 added lines, 0 removed lines.
Original line number Diff line number Diff line
require 'beaker-rspec'
require 'beaker_spec_helper'

include BeakerSpecHelper

hosts.each do |host|
  install_puppet_on host
  install_package host, 'git'
  install_package host, 'tar'
  install_package host, 'sudo'
  on host, 'rm /usr/sbin/policy-rc.d || true'
end

RSpec.configure do |c|
  module_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
  module_name = module_root.split('-').last

  # Readable test descriptions
  c.formatter = :documentation

  # Configure all nodes in nodeset
  c.before :suite do
    # Install module and dependencies
    puppet_module_install(:source => module_root, :module_name => module_name)
    hosts.each do |host|
      BeakerSpecHelper::spec_prep(host)
    end
  end
end