X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Facceptance%2Fdefined_with_params_spec.rb;fp=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Facceptance%2Fdefined_with_params_spec.rb;h=d8e5c8c7f116121ea21ebaa63f5bfd20c5415e7f;hb=131e09855e065be940e104d9ab0f18940cc76257;hp=a332bd638a887743bf704d870136db1cb3fb86a1;hpb=407d322498f4fde815abf381007fbecfe5c10b2b;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/spec/acceptance/defined_with_params_spec.rb b/3rdparty/modules/stdlib/spec/acceptance/defined_with_params_spec.rb old mode 100755 new mode 100644 index a332bd638..d8e5c8c7f --- a/3rdparty/modules/stdlib/spec/acceptance/defined_with_params_spec.rb +++ b/3rdparty/modules/stdlib/spec/acceptance/defined_with_params_spec.rb @@ -1,10 +1,8 @@ -#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'defined_with_params function' do describe 'success' do - it 'should successfully notify' do - pp = <<-EOS + pp1 = <<-DOC user { 'dan': ensure => present, } @@ -12,10 +10,29 @@ describe 'defined_with_params function' do if defined_with_params(User[dan], {'ensure' => 'present' }) { notify { 'User defined with ensure=>present': } } - EOS + DOC + it 'successfullies checks a type' do + apply_manifest(pp1, :catch_failures => true) do |r| + expect(r.stdout).to match(%r{Notice: User defined with ensure=>present}) + end + end + + pp2 = <<-DOC + class foo ( + $bar, + ) {} - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: User defined with ensure=>present/) + class { 'foo': + bar => 'baz', + } + + if defined_with_params(Class[foo], { 'bar' => 'baz' }) { + notify { 'Class foo defined with bar=>baz': } + } + DOC + it 'successfullies checks a class' do + apply_manifest(pp2, :catch_failures => true) do |r| + expect(r.stdout).to match(%r{Notice: Class foo defined with bar=>baz}) end end end