Revert "Update 3rdparty rabbitmq module"
[mirror/dsa-puppet.git] / 3rdparty / modules / rabbitmq / spec / unit / puppet / provider / rabbitmq_plugin / rabbitmqctl_spec.rb
index 3c0a757..c398b62 100644 (file)
@@ -1,24 +1,26 @@
-require 'spec_helper'
-
+require 'puppet'
+require 'mocha'
+RSpec.configure do |config|
+  config.mock_with :mocha
+end
 provider_class = Puppet::Type.type(:rabbitmq_plugin).provider(:rabbitmqplugins)
 describe provider_class do
-  let(:resource) do
-    Puppet::Type::Rabbitmq_plugin.new(
-      name: 'foo'
+  before :each do
+    @resource = Puppet::Type::Rabbitmq_plugin.new(
+      {:name => 'foo'}
     )
+    @provider = provider_class.new(@resource)
   end
-  let(:provider) { provider_class.new(resource) }
-
-  it 'matches plugins' do
-    provider.expects(:rabbitmqplugins).with('list', '-E', '-m').returns("foo\n")
-    expect(provider.exists?).to eq(true)
+  it 'should match plugins' do
+    @provider.expects(:rabbitmqplugins).with('list', '-E', '-m').returns("foo\n")
+    @provider.exists?.should == 'foo'
   end
-  it 'calls rabbitmqplugins to enable' do
-    provider.expects(:rabbitmqplugins).with('enable', 'foo')
-    provider.create
+  it 'should call rabbitmqplugins to enable' do
+    @provider.expects(:rabbitmqplugins).with('enable', 'foo')
+    @provider.create
   end
-  it 'calls rabbitmqplugins to disable' do
-    provider.expects(:rabbitmqplugins).with('disable', 'foo')
-    provider.destroy
+  it 'should call rabbitmqplugins to disable' do
+    @provider.expects(:rabbitmqplugins).with('disable', 'foo')
+    @provider.destroy
   end
 end