3 RSpec.configure do |config|
4 config.mock_with :mocha
6 provider_class = Puppet::Type.type(:rabbitmq_vhost).provider(:rabbitmqctl)
7 describe provider_class do
9 @resource = Puppet::Type::Rabbitmq_vhost.new(
12 @provider = provider_class.new(@resource)
14 it 'should match vhost names' do
15 @provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT
20 @provider.exists?.should == 'foo'
22 it 'should not match if no vhosts on system' do
23 @provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT
27 @provider.exists?.should be_nil
29 it 'should not match if no matching vhosts on system' do
30 @provider.expects(:rabbitmqctl).with('-q', 'list_vhosts').returns <<-EOT
35 @provider.exists?.should be_nil
37 it 'should call rabbitmqctl to create' do
38 @provider.expects(:rabbitmqctl).with('add_vhost', 'foo')
41 it 'should call rabbitmqctl to create' do
42 @provider.expects(:rabbitmqctl).with('delete_vhost', 'foo')