2 require 'puppet/type/rabbitmq_queue'
4 describe Puppet::Type.type(:rabbitmq_queue) do
6 @queue = Puppet::Type.type(:rabbitmq_queue).new(
10 'x-message-ttl' => 45,
11 'x-dead-letter-exchange' => 'deadexchange'
15 it 'should accept an queue name' do
16 @queue[:name] = 'dan@pl'
17 @queue[:name].should == 'dan@pl'
19 it 'should require a name' do
21 Puppet::Type.type(:rabbitmq_queue).new({})
22 }.to raise_error(Puppet::Error, 'Title or name must be provided')
24 it 'should not allow whitespace in the name' do
27 }.to raise_error(Puppet::Error, /Valid values match/)
29 it 'should not allow names without @' do
32 }.to raise_error(Puppet::Error, /Valid values match/)
35 it 'should accept an arguments with numbers value' do
36 @queue[:arguments] = {'x-message-ttl' => 30}
37 @queue[:arguments].to_json.should == "{\"x-message-ttl\":30}"
38 @queue[:arguments]['x-message-ttl'].should == 30
41 it 'should accept an arguments with string value' do
42 @queue[:arguments] = {'x-dead-letter-exchange' => 'catchallexchange'}
43 @queue[:arguments].to_json.should == "{\"x-dead-letter-exchange\":\"catchallexchange\"}"
46 it 'should accept an queue durable' do
47 @queue[:durable] = :true
48 @queue[:durable].should == :true
51 it 'should accept a user' do
53 @queue[:user].should == :root
56 it 'should accept a password' do
57 @queue[:password] = :PaSsw0rD
58 @queue[:password].should == :PaSsw0rD