From: Ken Barber Date: Wed, 24 Apr 2013 21:13:48 +0000 (+0100) Subject: Add system tests for ensure parameter X-Git-Tag: 0.3.0~1^2~2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=d53d973ebbdddf39fc61d1b4126f41b64f4265a2;p=puppet-modules%2Fpuppetlabs-firewall.git Add system tests for ensure parameter Signed-off-by: Ken Barber --- diff --git a/spec/system/class_spec.rb b/spec/system/class_spec.rb index 8ba8415..6199c2f 100644 --- a/spec/system/class_spec.rb +++ b/spec/system/class_spec.rb @@ -1,23 +1,73 @@ require 'spec_helper_system' describe "firewall class:" do - let(:pp) do - pp = <<-EOS - class { 'firewall': } - EOS + context 'no params:' do + let(:pp) do + pp = <<-EOS.gsub(/^\s{8}/,'') + class { 'firewall': } + EOS + end + + it "should run without event" do + puppet_apply(pp) do |r| + r[:stderr].should == '' + r[:exit_code].should_not eq(1) + end + end + + it "should be idempotent" do + puppet_apply(pp) do |r| + r[:stderr].should == '' + r[:exit_code].should == 0 + end + end end - it "should run without event" do - puppet_apply(pp) do |r| - r[:stderr].should == '' - r[:exit_code].should_not eq(1) + context 'ensure => stopped:' do + let(:pp) do + pp = <<-EOS.gsub(/^\s{8}/,'') + class { 'firewall': + ensure => stopped, + } + EOS + end + + it "should run without event" do + puppet_apply(pp) do |r| + r[:stderr].should == '' + r[:exit_code].should_not eq(1) + end + end + + it "should be idempotent" do + puppet_apply(pp) do |r| + r[:stderr].should == '' + r[:exit_code].should == 0 + end end end - it "should be idempotent" do - puppet_apply(pp) do |r| - r[:stderr].should == '' - r[:exit_code].should == 0 + context 'ensure => running:' do + let(:pp) do + pp = <<-EOS.gsub(/^\s{8}/,'') + class { 'firewall': + ensure => running, + } + EOS + end + + it "should run without event" do + puppet_apply(pp) do |r| + r[:stderr].should == '' + r[:exit_code].should_not eq(1) + end + end + + it "should be idempotent" do + puppet_apply(pp) do |r| + r[:stderr].should == '' + r[:exit_code].should == 0 + end end end end