From 1d29b3c902163037759922907804049c6f57f56d Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 24 Mar 2018 15:46:11 +0100 Subject: [PATCH] add acceptance test to verify default values --- spec/acceptance/init_spec.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 spec/acceptance/init_spec.rb diff --git a/spec/acceptance/init_spec.rb b/spec/acceptance/init_spec.rb new file mode 100644 index 000000000..651a9a65f --- /dev/null +++ b/spec/acceptance/init_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper_acceptance' + +describe 'nginx class' do + context 'default parameters' do + # Using puppet_apply as a helper + it 'works idempotently with no errors' do + pp = 'include nginx' + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + + # do some basic checks + pkg = case fact('os.family') + when 'Archlinux' + 'nginx-mainline' + else + 'nginx' + end + describe package(pkg) do + it { is_expected.to be_installed } + end + + describe service('nginx') do + it { is_expected.to be_running } + it { is_expected.to be_enabled } + end + + describe port(80) do + it { is_expected.to be_listening } + end + end +end