2 require 'puppet/type/rabbitmq_exchange'
3 describe Puppet::Type.type(:rabbitmq_exchange) do
5 @exchange = Puppet::Type.type(:rabbitmq_exchange).new(
13 it 'should accept an exchange name' do
14 @exchange[:name] = 'dan@pl'
15 @exchange[:name].should == 'dan@pl'
17 it 'should require a name' do
19 Puppet::Type.type(:rabbitmq_exchange).new({})
20 }.to raise_error(Puppet::Error, 'Title or name must be provided')
22 it 'should not allow whitespace in the name' do
24 @exchange[:name] = 'b r'
25 }.to raise_error(Puppet::Error, /Valid values match/)
27 it 'should not allow names without @' do
29 @exchange[:name] = 'b_r'
30 }.to raise_error(Puppet::Error, /Valid values match/)
33 it 'should accept an exchange type' do
34 @exchange[:type] = :direct
35 @exchange[:type].should == :direct
37 it 'should require a type' do
39 Puppet::Type.type(:rabbitmq_exchange).new(:name => 'foo@bar')
40 }.to raise_error(/.*must set type when creating exchange.*/)
42 it 'should not require a type when destroying' do
44 Puppet::Type.type(:rabbitmq_exchange).new(:name => 'foo@bar', :ensure => :absent)
48 it 'should accept a user' do
49 @exchange[:user] = :root
50 @exchange[:user].should == :root
53 it 'should accept a password' do
54 @exchange[:password] = :PaSsw0rD
55 @exchange[:password].should == :PaSsw0rD