Update 3rdparty rabbitmq module
[mirror/dsa-puppet.git] / 3rdparty / modules / rabbitmq / spec / unit / puppet / type / rabbitmq_plugin_spec.rb
diff --git a/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_plugin_spec.rb b/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_plugin_spec.rb
new file mode 100644 (file)
index 0000000..194df66
--- /dev/null
@@ -0,0 +1,24 @@
+require 'spec_helper'
+describe Puppet::Type.type(:rabbitmq_plugin) do
+  let(:plugin) do
+    Puppet::Type.type(:rabbitmq_plugin).new(name: 'foo')
+  end
+
+  it 'accepts a plugin name' do
+    plugin[:name] = 'plugin-name'
+    expect(plugin[:name]).to eq('plugin-name')
+  end
+  it 'requires a name' do
+    expect do
+      Puppet::Type.type(:rabbitmq_plugin).new({})
+    end.to raise_error(Puppet::Error, 'Title or name must be provided')
+  end
+  it 'defaults to a umask of 0022' do
+    expect(plugin[:umask]).to eq(0o022)
+  end
+  it 'does not allow a non-octal value to be specified' do
+    expect do
+      plugin[:umask] = '198'
+    end.to raise_error(Puppet::Error, %r{The umask specification is invalid: "198"})
+  end
+end