Add missing new files from commit 131e09855e06
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / type3x_spec.rb
diff --git a/3rdparty/modules/stdlib/spec/acceptance/type3x_spec.rb b/3rdparty/modules/stdlib/spec/acceptance/type3x_spec.rb
new file mode 100644 (file)
index 0000000..4b75548
--- /dev/null
@@ -0,0 +1,27 @@
+require 'spec_helper_acceptance'
+
+describe 'type3x function' do
+  describe 'success' do
+    {
+      %{type3x({ 'a' => 'hash' })} => 'Hash',
+      %{type3x(['array'])}         => 'Array',
+      %{type3x(false)}             => 'Boolean',
+      %{type3x('asdf')}            => 'String',
+      %{type3x(242)}               => 'Integer',
+      %{type3x(3.14)}              => 'Float',
+    }.each do |pp, type|
+      it "with type #{type}" do
+        apply_manifest(pp, :catch_failures => true)
+      end
+    end
+  end
+
+  describe 'failure' do
+    pp_fail = <<-MANIFEST
+      type3x('one','two')
+    MANIFEST
+    it 'handles improper number of arguments' do
+      expect(apply_manifest(pp_fail, :expect_failures => true).stderr).to match(%r{Wrong number of arguments})
+    end
+  end
+end