2 require 'puppet/type/rabbitmq_binding'
3 describe Puppet::Type.type(:rabbitmq_binding) do
5 @binding = Puppet::Type.type(:rabbitmq_binding).new(
6 :name => 'foo@blub@bar',
7 :destination_type => :queue
10 it 'should accept an queue name' do
11 @binding[:name] = 'dan@dude@pl'
12 @binding[:name].should == 'dan@dude@pl'
14 it 'should require a name' do
16 Puppet::Type.type(:rabbitmq_binding).new({})
17 }.to raise_error(Puppet::Error, 'Title or name must be provided')
19 it 'should not allow whitespace in the name' do
21 @binding[:name] = 'b r'
22 }.to raise_error(Puppet::Error, /Valid values match/)
24 it 'should not allow names without one @' do
26 @binding[:name] = 'b_r'
27 }.to raise_error(Puppet::Error, /Valid values match/)
30 it 'should not allow names without two @' do
32 @binding[:name] = 'b@r'
33 }.to raise_error(Puppet::Error, /Valid values match/)
36 it 'should accept an binding destination_type' do
37 @binding[:destination_type] = :exchange
38 @binding[:destination_type].should == :exchange
41 it 'should accept a user' do
42 @binding[:user] = :root
43 @binding[:user].should == :root
46 it 'should accept a password' do
47 @binding[:password] = :PaSsw0rD
48 @binding[:password].should == :PaSsw0rD