X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Frabbitmq%2Fspec%2Funit%2Fpuppet%2Ftype%2Frabbitmq_queue_spec.rb;fp=3rdparty%2Fmodules%2Frabbitmq%2Fspec%2Funit%2Fpuppet%2Ftype%2Frabbitmq_queue_spec.rb;h=4fd7b34efdf2f9cffaed7a28b41245637efb426f;hb=24caa46729f80fbba4be8b9b26ebcb3acc4cb0fb;hp=625c3fe3ea7e1fba3753e9d34f5714c4f8f91493;hpb=c7e7bcc28cc5dc48a7e284a3c82f33df27d1f57d;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_queue_spec.rb b/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_queue_spec.rb index 625c3fe3e..4fd7b34ef 100644 --- a/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_queue_spec.rb +++ b/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_queue_spec.rb @@ -1,58 +1,60 @@ -require 'spec_helper' +require 'puppet' +require 'puppet/type/rabbitmq_queue' +require 'json' describe Puppet::Type.type(:rabbitmq_queue) do - let(:queue) do - Puppet::Type.type(:rabbitmq_queue).new( - name: 'foo@bar', - durable: :true, - arguments: { + before :each do + @queue = Puppet::Type.type(:rabbitmq_queue).new( + :name => 'foo@bar', + :durable => :true, + :arguments => { 'x-message-ttl' => 45, 'x-dead-letter-exchange' => 'deadexchange' } ) end - - it 'accepts an queue name' do - queue[:name] = 'dan@pl' - expect(queue[:name]).to eq('dan@pl') + it 'should accept an queue name' do + @queue[:name] = 'dan@pl' + @queue[:name].should == 'dan@pl' end - it 'requires a name' do - expect do + it 'should require a name' do + expect { Puppet::Type.type(:rabbitmq_queue).new({}) - end.to raise_error(Puppet::Error, 'Title or name must be provided') + }.to raise_error(Puppet::Error, 'Title or name must be provided') end - it 'does not allow whitespace in the name' do - expect do - queue[:name] = 'b r' - end.to raise_error(Puppet::Error, %r{Valid values match}) + it 'should not allow whitespace in the name' do + expect { + @queue[:name] = 'b r' + }.to raise_error(Puppet::Error, /Valid values match/) end - it 'does not allow names without @' do - expect do - queue[:name] = 'b_r' - end.to raise_error(Puppet::Error, %r{Valid values match}) + it 'should not allow names without @' do + expect { + @queue[:name] = 'b_r' + }.to raise_error(Puppet::Error, /Valid values match/) end - it 'accepts an arguments with numbers value' do - queue[:arguments] = { 'x-message-ttl' => 30 } - expect(queue[:arguments].to_json).to eq('{"x-message-ttl":30}') + it 'should accept an arguments with numbers value' do + @queue[:arguments] = {'x-message-ttl' => 30} + @queue[:arguments].to_json.should == "{\"x-message-ttl\":30}" + @queue[:arguments]['x-message-ttl'].should == 30 end - it 'accepts an arguments with string value' do - queue[:arguments] = { 'x-dead-letter-exchange' => 'catchallexchange' } - expect(queue[:arguments].to_json).to eq('{"x-dead-letter-exchange":"catchallexchange"}') + it 'should accept an arguments with string value' do + @queue[:arguments] = {'x-dead-letter-exchange' => 'catchallexchange'} + @queue[:arguments].to_json.should == "{\"x-dead-letter-exchange\":\"catchallexchange\"}" end - it 'accepts an queue durable' do - queue[:durable] = :true - expect(queue[:durable]).to eq(:true) + it 'should accept an queue durable' do + @queue[:durable] = :true + @queue[:durable].should == :true end - it 'accepts a user' do - queue[:user] = :root - expect(queue[:user]).to eq(:root) + it 'should accept a user' do + @queue[:user] = :root + @queue[:user].should == :root end - it 'accepts a password' do - queue[:password] = :PaSsw0rD - expect(queue[:password]).to eq(:PaSsw0rD) + it 'should accept a password' do + @queue[:password] = :PaSsw0rD + @queue[:password].should == :PaSsw0rD end end