]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - 3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_vhost_spec.rb
move to puppetlabs rabbitmq module
[dsa-puppet.git] / 3rdparty / modules / rabbitmq / spec / unit / puppet / type / rabbitmq_vhost_spec.rb
diff --git a/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_vhost_spec.rb b/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_vhost_spec.rb
new file mode 100644 (file)
index 0000000..70b8e37
--- /dev/null
@@ -0,0 +1,21 @@
+require 'puppet'
+require 'puppet/type/rabbitmq_vhost'
+describe Puppet::Type.type(:rabbitmq_vhost) do
+  before :each do
+    @vhost = Puppet::Type.type(:rabbitmq_vhost).new(:name => 'foo')
+  end
+  it 'should accept a vhost name' do
+    @vhost[:name] = 'dan'
+    @vhost[:name].should == 'dan'
+  end
+  it 'should require a name' do
+    expect {
+      Puppet::Type.type(:rabbitmq_vhost).new({})
+    }.to raise_error(Puppet::Error, 'Title or name must be provided')
+  end
+  it 'should not allow whitespace in the name' do
+    expect {
+      @vhost[:name] = 'b r'
+    }.to raise_error(Puppet::Error, /Valid values match/)
+  end
+end