]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_binding_spec.rb
move to puppetlabs rabbitmq module
[dsa-puppet.git] / 3rdparty / modules / rabbitmq / spec / unit / puppet / type / rabbitmq_binding_spec.rb
1 require 'puppet'
2 require 'puppet/type/rabbitmq_binding'
3 describe Puppet::Type.type(:rabbitmq_binding) do
4   before :each do
5     @binding = Puppet::Type.type(:rabbitmq_binding).new(
6       :name => 'foo@blub@bar',
7       :destination_type => :queue
8     )
9   end
10   it 'should accept an queue name' do
11     @binding[:name] = 'dan@dude@pl'
12     @binding[:name].should == 'dan@dude@pl'
13   end
14   it 'should require a name' do
15     expect {
16       Puppet::Type.type(:rabbitmq_binding).new({})
17     }.to raise_error(Puppet::Error, 'Title or name must be provided')
18   end
19   it 'should not allow whitespace in the name' do
20     expect {
21       @binding[:name] = 'b r'
22     }.to raise_error(Puppet::Error, /Valid values match/)
23   end
24   it 'should not allow names without one @' do
25     expect {
26       @binding[:name] = 'b_r'
27     }.to raise_error(Puppet::Error, /Valid values match/)
28   end
29
30   it 'should not allow names without two @' do
31     expect {
32       @binding[:name] = 'b@r'
33     }.to raise_error(Puppet::Error, /Valid values match/)
34   end
35
36   it 'should accept an binding destination_type' do
37     @binding[:destination_type] = :exchange
38     @binding[:destination_type].should == :exchange
39   end
40
41   it 'should accept a user' do
42     @binding[:user] = :root
43     @binding[:user].should == :root
44   end
45
46   it 'should accept a password' do
47     @binding[:password] = :PaSsw0rD
48     @binding[:password].should == :PaSsw0rD
49   end
50 end