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