X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Frabbitmq%2Fspec%2Funit%2Fpuppet%2Ftype%2Frabbitmq_exchange_spec.rb;fp=3rdparty%2Fmodules%2Frabbitmq%2Fspec%2Funit%2Fpuppet%2Ftype%2Frabbitmq_exchange_spec.rb;h=e1be271df8029f2cdec794de3714639b94b3d941;hb=921e69100a563cf143f56a3905d8362336d939ff;hp=1500122cdb876393ab9601665f979985c9278245;hpb=b54f52d2899c5785923c804fdfbba0782c147da4;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_exchange_spec.rb b/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_exchange_spec.rb index 1500122cd..e1be271df 100644 --- a/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_exchange_spec.rb +++ b/3rdparty/modules/rabbitmq/spec/unit/puppet/type/rabbitmq_exchange_spec.rb @@ -1,57 +1,57 @@ -require 'puppet' -require 'puppet/type/rabbitmq_exchange' +require 'spec_helper' describe Puppet::Type.type(:rabbitmq_exchange) do - before :each do - @exchange = Puppet::Type.type(:rabbitmq_exchange).new( - :name => 'foo@bar', - :type => :topic, - :internal => false, - :auto_delete => false, - :durable => true + let(:exchange) do + Puppet::Type.type(:rabbitmq_exchange).new( + name: 'foo@bar', + type: :topic, + internal: false, + auto_delete: false, + durable: true ) end - it 'should accept an exchange name' do - @exchange[:name] = 'dan@pl' - @exchange[:name].should == 'dan@pl' + + it 'accepts an exchange name' do + exchange[:name] = 'dan@pl' + expect(exchange[:name]).to eq('dan@pl') end - it 'should require a name' do - expect { + it 'requires a name' do + expect do Puppet::Type.type(:rabbitmq_exchange).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 { - @exchange[:name] = 'b r' - }.to raise_error(Puppet::Error, /Valid values match/) + it 'does not allow whitespace in the name' do + expect do + exchange[:name] = 'b r' + end.to raise_error(Puppet::Error, %r{Valid values match}) end - it 'should not allow names without @' do - expect { - @exchange[:name] = 'b_r' - }.to raise_error(Puppet::Error, /Valid values match/) + it 'does not allow names without @' do + expect do + exchange[:name] = 'b_r' + end.to raise_error(Puppet::Error, %r{Valid values match}) end - it 'should accept an exchange type' do - @exchange[:type] = :direct - @exchange[:type].should == :direct + it 'accepts an exchange type' do + exchange[:type] = :direct + expect(exchange[:type]).to eq(:direct) end - it 'should require a type' do - expect { - Puppet::Type.type(:rabbitmq_exchange).new(:name => 'foo@bar') - }.to raise_error(/.*must set type when creating exchange.*/) + it 'requires a type' do + expect do + Puppet::Type.type(:rabbitmq_exchange).new(name: 'foo@bar') + end.to raise_error(%r{.*must set type when creating exchange.*}) end - it 'should not require a type when destroying' do - expect { - Puppet::Type.type(:rabbitmq_exchange).new(:name => 'foo@bar', :ensure => :absent) - }.to_not raise_error + it 'does not require a type when destroying' do + expect do + Puppet::Type.type(:rabbitmq_exchange).new(name: 'foo@bar', ensure: :absent) + end.not_to raise_error end - it 'should accept a user' do - @exchange[:user] = :root - @exchange[:user].should == :root + it 'accepts a user' do + exchange[:user] = :root + expect(exchange[:user]).to eq(:root) end - it 'should accept a password' do - @exchange[:password] = :PaSsw0rD - @exchange[:password].should == :PaSsw0rD + it 'accepts a password' do + exchange[:password] = :PaSsw0rD + expect(exchange[:password]).to eq(:PaSsw0rD) end end