move shared examples for action on non-existent resource to common.rb
This commit is contained in:
parent
436bd1ea4e
commit
0ac14ce0df
@ -1,5 +1,23 @@
|
|||||||
require 'mixlib/shellout'
|
require 'mixlib/shellout'
|
||||||
|
|
||||||
|
# Shared code used to test providers of CIB objects
|
||||||
|
|
||||||
|
shared_examples "action on non-existent resource" do |action, cmd, expected_error|
|
||||||
|
it "should not attempt to #{action.to_s} a non-existent resource" do
|
||||||
|
expect_definition("")
|
||||||
|
|
||||||
|
if expected_error
|
||||||
|
expect { provider.run_action action }.to \
|
||||||
|
raise_error(RuntimeError, expected_error)
|
||||||
|
else
|
||||||
|
provider.run_action action
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(@chef_run).not_to run_execute(cmd)
|
||||||
|
expect(@resource).not_to be_updated
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module Chef::RSpec
|
module Chef::RSpec
|
||||||
module Pacemaker
|
module Pacemaker
|
||||||
module Common
|
module Common
|
||||||
|
@ -132,22 +132,6 @@ describe "Chef::Provider::PacemakerPrimitive" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples "action on non-existent resource" do |action, cmd, expected_error|
|
|
||||||
it "should not attempt to #{action.to_s} a non-existent resource" do
|
|
||||||
expect_definition("")
|
|
||||||
|
|
||||||
if expected_error
|
|
||||||
expect { provider.run_action action }.to \
|
|
||||||
raise_error(RuntimeError, expected_error)
|
|
||||||
else
|
|
||||||
provider.run_action action
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(@chef_run).not_to run_execute(cmd)
|
|
||||||
expect(@resource).not_to be_updated
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe ":delete action" do
|
describe ":delete action" do
|
||||||
it_should_behave_like "action on non-existent resource", \
|
it_should_behave_like "action on non-existent resource", \
|
||||||
:delete, "crm configure delete #{rsc.name}", nil
|
:delete, "crm configure delete #{rsc.name}", nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user