X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Frabbitmq%2Fspec%2Funit%2Fpuppet%2Fprovider%2Frabbitmq_vhost%2Frabbitmqctl_spec.rb;fp=3rdparty%2Fmodules%2Frabbitmq%2Fspec%2Funit%2Fpuppet%2Fprovider%2Frabbitmq_vhost%2Frabbitmqctl_spec.rb;h=d4ed32840af207701cb1c08e3afbe64cf83e7c31;hb=94a8783f522bbf2996cb8a59b977dea583e8b0c7;hp=6c8cce8df73f4d14abf56416c66d5d8b4b8ab685;hpb=e107504bce7d9b21cc301124fc7c39fdb0762374;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_vhost/rabbitmqctl_spec.rb b/3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_vhost/rabbitmqctl_spec.rb index 6c8cce8df..d4ed32840 100644 --- a/3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_vhost/rabbitmqctl_spec.rb +++ b/3rdparty/modules/rabbitmq/spec/unit/puppet/provider/rabbitmq_vhost/rabbitmqctl_spec.rb @@ -1,45 +1,43 @@ -require 'puppet' -require 'mocha' -RSpec.configure do |config| - config.mock_with :mocha -end +require 'spec_helper' + provider_class = Puppet::Type.type(:rabbitmq_vhost).provider(:rabbitmqctl) describe provider_class do - before :each do - @resource = Puppet::Type::Rabbitmq_vhost.new( - {:name => 'foo'} + let(:resource) do + Puppet::Type::Rabbitmq_vhost.new( + name: 'foo' ) - @provider = provider_class.new(@resource) end - it 'should match vhost names' do - @provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT + let(:provider) { provider_class.new(resource) } + + it 'matches vhost names' do + provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT Listing vhosts ... foo ...done. EOT - @provider.exists?.should == 'foo' + expect(provider.exists?).to eq(true) end - it 'should not match if no vhosts on system' do - @provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT + it 'does not match if no vhosts on system' do + provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT Listing vhosts ... ...done. EOT - @provider.exists?.should be_nil + expect(provider.exists?).to eq(false) end - it 'should not match if no matching vhosts on system' do - @provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT + it 'does not match if no matching vhosts on system' do + provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT Listing vhosts ... fooey ...done. EOT - @provider.exists?.should be_nil + expect(provider.exists?).to eq(false) end - it 'should call rabbitmqctl to create' do - @provider.expects(:rabbitmqctl).with('add_vhost', 'foo') - @provider.create + it 'calls rabbitmqctl to create' do + provider.expects(:rabbitmqctl).with('add_vhost', 'foo') + provider.create end - it 'should call rabbitmqctl to create' do - @provider.expects(:rabbitmqctl).with('delete_vhost', 'foo') - @provider.destroy + it 'calls rabbitmqctl to create' do + provider.expects(:rabbitmqctl).with('delete_vhost', 'foo') + provider.destroy end end