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=625c3fe3ea7e1fba3753e9d34f5714c4f8f91493;hb=94a8783f522bbf2996cb8a59b977dea583e8b0c7;hp=4fd7b34efdf2f9cffaed7a28b41245637efb426f;hpb=e107504bce7d9b21cc301124fc7c39fdb0762374;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 4fd7b34ef..625c3fe3e 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,60 +1,58 @@ -require 'puppet' -require 'puppet/type/rabbitmq_queue' -require 'json' +require 'spec_helper' describe Puppet::Type.type(:rabbitmq_queue) do - before :each do - @queue = Puppet::Type.type(:rabbitmq_queue).new( - :name => 'foo@bar', - :durable => :true, - :arguments => { + let(:queue) do + Puppet::Type.type(:rabbitmq_queue).new( + name: 'foo@bar', + durable: :true, + arguments: { 'x-message-ttl' => 45, 'x-dead-letter-exchange' => 'deadexchange' } ) end - it 'should accept an queue name' do - @queue[:name] = 'dan@pl' - @queue[:name].should == 'dan@pl' + + it 'accepts an queue name' do + queue[:name] = 'dan@pl' + expect(queue[:name]).to eq('dan@pl') end - it 'should require a name' do - expect { + it 'requires a name' do + expect do Puppet::Type.type(:rabbitmq_queue).new({}) - }.to raise_error(Puppet::Error, 'Title or name must be provided') + end.to raise_error(Puppet::Error, 'Title or name must be provided') end - it 'should not allow whitespace in the name' do - expect { - @queue[:name] = 'b r' - }.to raise_error(Puppet::Error, /Valid values match/) + 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}) end - it 'should not allow names without @' do - expect { - @queue[:name] = 'b_r' - }.to raise_error(Puppet::Error, /Valid values match/) + it 'does not allow names without @' do + expect do + queue[:name] = 'b_r' + end.to raise_error(Puppet::Error, %r{Valid values match}) end - 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 + 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}') end - 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\"}" + 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"}') end - it 'should accept an queue durable' do - @queue[:durable] = :true - @queue[:durable].should == :true + it 'accepts an queue durable' do + queue[:durable] = :true + expect(queue[:durable]).to eq(:true) end - it 'should accept a user' do - @queue[:user] = :root - @queue[:user].should == :root + it 'accepts a user' do + queue[:user] = :root + expect(queue[:user]).to eq(:root) end - it 'should accept a password' do - @queue[:password] = :PaSsw0rD - @queue[:password].should == :PaSsw0rD + it 'accepts a password' do + queue[:password] = :PaSsw0rD + expect(queue[:password]).to eq(:PaSsw0rD) end end