]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/inifile/spec/functions/create_ini_settings_spec.rb
add puppetlabs/inifile to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / inifile / spec / functions / create_ini_settings_spec.rb
1 #! /usr/bin/env ruby
2
3 require 'spec_helper'
4 require 'rspec-puppet'
5
6 describe 'create_ini_settings' do
7   before :each do
8     Puppet::Parser::Functions.autoloader.loadall
9     Puppet::Parser::Functions.function(:create_resources)
10   end
11
12   describe 'argument handling' do
13     it { should run.with_params.and_raise_error(Puppet::ParseError, /0 for 1 or 2/) }
14     it { should run.with_params(1,2,3).and_raise_error(Puppet::ParseError, /3 for 1 or 2/) }
15     it { should run.with_params('foo').and_raise_error(Puppet::ParseError, /Requires all arguments/) }
16     it { should run.with_params({},'foo').and_raise_error(Puppet::ParseError, /Requires all arguments/) }
17
18     it { should run.with_params({}) }
19     it { should run.with_params({},{}) }
20
21     it { should run.with_params({ 1 => 2 }).and_raise_error(Puppet::ParseError, /Section 1 must contain a Hash/) }
22   end
23 end