X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Frabbitmq%2Fspec%2Funit%2Fpuppet%2Ftype%2Frabbitmq_exchange_spec.rb;h=1500122cdb876393ab9601665f979985c9278245;hb=24caa46729f80fbba4be8b9b26ebcb3acc4cb0fb;hp=e1be271df8029f2cdec794de3714639b94b3d941;hpb=c7e7bcc28cc5dc48a7e284a3c82f33df27d1f57d;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 e1be271df..1500122cd 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 'spec_helper' +require 'puppet' +require 'puppet/type/rabbitmq_exchange' describe Puppet::Type.type(:rabbitmq_exchange) do - let(:exchange) do - Puppet::Type.type(:rabbitmq_exchange).new( - name: 'foo@bar', - type: :topic, - internal: false, - auto_delete: false, - durable: true + before :each do + @exchange = Puppet::Type.type(:rabbitmq_exchange).new( + :name => 'foo@bar', + :type => :topic, + :internal => false, + :auto_delete => false, + :durable => true ) end - - it 'accepts an exchange name' do - exchange[:name] = 'dan@pl' - expect(exchange[:name]).to eq('dan@pl') + it 'should accept an exchange name' do + @exchange[:name] = 'dan@pl' + @exchange[:name].should == 'dan@pl' end - it 'requires a name' do - expect do + it 'should require a name' do + expect { Puppet::Type.type(:rabbitmq_exchange).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 - exchange[:name] = 'b r' - end.to raise_error(Puppet::Error, %r{Valid values match}) + it 'should not allow whitespace in the name' do + expect { + @exchange[:name] = 'b r' + }.to raise_error(Puppet::Error, /Valid values match/) end - it 'does not allow names without @' do - expect do - exchange[:name] = 'b_r' - end.to raise_error(Puppet::Error, %r{Valid values match}) + it 'should not allow names without @' do + expect { + @exchange[:name] = 'b_r' + }.to raise_error(Puppet::Error, /Valid values match/) end - it 'accepts an exchange type' do - exchange[:type] = :direct - expect(exchange[:type]).to eq(:direct) + it 'should accept an exchange type' do + @exchange[:type] = :direct + @exchange[:type].should == :direct end - 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.*}) + 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.*/) end - 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 + 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 end - it 'accepts a user' do - exchange[:user] = :root - expect(exchange[:user]).to eq(:root) + it 'should accept a user' do + @exchange[:user] = :root + @exchange[:user].should == :root end - it 'accepts a password' do - exchange[:password] = :PaSsw0rD - expect(exchange[:password]).to eq(:PaSsw0rD) + it 'should accept a password' do + @exchange[:password] = :PaSsw0rD + @exchange[:password].should == :PaSsw0rD end end