]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - 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
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 (file)
index 0000000..e40fb09
--- /dev/null
@@ -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