X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=3rdparty%2Fmodules%2Finifile%2Fspec%2Ffunctions%2Fcreate_ini_settings_spec.rb;fp=3rdparty%2Fmodules%2Finifile%2Fspec%2Ffunctions%2Fcreate_ini_settings_spec.rb;h=e40fb09aa3676e99cd8b7948b34e8d06014323c8;hb=169cb77932b427c80d2731ca5938ecd617a5ad57;hp=0000000000000000000000000000000000000000;hpb=3b71516ded080d1e140515fee96da4749ebaf6f1;p=dsa-puppet.git diff --git a/3rdparty/modules/inifile/spec/functions/create_ini_settings_spec.rb b/3rdparty/modules/inifile/spec/functions/create_ini_settings_spec.rb new file mode 100644 index 00000000..e40fb09a --- /dev/null +++ b/3rdparty/modules/inifile/spec/functions/create_ini_settings_spec.rb @@ -0,0 +1,23 @@ +#! /usr/bin/env ruby + +require 'spec_helper' +require 'rspec-puppet' + +describe 'create_ini_settings' do + before :each do + Puppet::Parser::Functions.autoloader.loadall + Puppet::Parser::Functions.function(:create_resources) + end + + describe 'argument handling' do + it { should run.with_params.and_raise_error(Puppet::ParseError, /0 for 1 or 2/) } + it { should run.with_params(1,2,3).and_raise_error(Puppet::ParseError, /3 for 1 or 2/) } + it { should run.with_params('foo').and_raise_error(Puppet::ParseError, /Requires all arguments/) } + it { should run.with_params({},'foo').and_raise_error(Puppet::ParseError, /Requires all arguments/) } + + it { should run.with_params({}) } + it { should run.with_params({},{}) } + + it { should run.with_params({ 1 => 2 }).and_raise_error(Puppet::ParseError, /Section 1 must contain a Hash/) } + end +end