move duplicated test_modify to Chef::RSpec::Pacemaker::CIBObject
This commit is contained in:
@@ -23,6 +23,25 @@ shared_context "a Pacemaker LWRP" do
|
||||
let (:provider) { @provider_class.new(@resource, @run_context) }
|
||||
end
|
||||
|
||||
module Chef::RSpec
|
||||
module Pacemaker
|
||||
module CIBObject
|
||||
def test_modify(expected_cmds)
|
||||
yield
|
||||
|
||||
stub_shellout(fixture.definition_string)
|
||||
|
||||
provider.run_action :create
|
||||
|
||||
expected_cmds.each do |cmd|
|
||||
expect(@chef_run).to run_execute(cmd)
|
||||
end
|
||||
expect(@resource).to be_updated
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples "action on non-existent resource" do |action, cmd, expected_error|
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
|
@@ -30,18 +30,7 @@ describe "Chef::Provider::PacemakerClone" do
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
describe ":create action" do
|
||||
def test_modify(expected_cmds)
|
||||
yield
|
||||
|
||||
stub_shellout(fixture.definition_string)
|
||||
|
||||
provider.run_action :create
|
||||
|
||||
expected_cmds.each do |cmd|
|
||||
expect(@chef_run).to run_execute(cmd)
|
||||
end
|
||||
expect(@resource).to be_updated
|
||||
end
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
it "should modify the clone if the resource is changed" do
|
||||
expected = fixture.dup
|
||||
|
@@ -30,18 +30,7 @@ describe "Chef::Provider::PacemakerColocation" do
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
describe ":create action" do
|
||||
def test_modify(expected_cmds)
|
||||
yield
|
||||
|
||||
stub_shellout(fixture.definition_string)
|
||||
|
||||
provider.run_action :create
|
||||
|
||||
expected_cmds.each do |cmd|
|
||||
expect(@chef_run).to run_execute(cmd)
|
||||
end
|
||||
expect(@resource).to be_updated
|
||||
end
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
it "should modify the constraint if it has a different score" do
|
||||
new_score = '100'
|
||||
|
@@ -30,18 +30,7 @@ describe "Chef::Provider::PacemakerGroup" do
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
describe ":create action" do
|
||||
def test_modify(expected_cmds)
|
||||
yield
|
||||
|
||||
stub_shellout(fixture.definition_string)
|
||||
|
||||
provider.run_action :create
|
||||
|
||||
expected_cmds.each do |cmd|
|
||||
expect(@chef_run).to run_execute(cmd)
|
||||
end
|
||||
expect(@resource).to be_updated
|
||||
end
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
it "should modify the group if it has a member resource added" do
|
||||
expected = fixture.dup
|
||||
|
@@ -30,18 +30,7 @@ describe "Chef::Provider::PacemakerLocation" do
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
describe ":create action" do
|
||||
def test_modify(expected_cmds)
|
||||
yield
|
||||
|
||||
stub_shellout(fixture.definition_string)
|
||||
|
||||
provider.run_action :create
|
||||
|
||||
expected_cmds.each do |cmd|
|
||||
expect(@chef_run).to run_execute(cmd)
|
||||
end
|
||||
expect(@resource).to be_updated
|
||||
end
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
it "should modify the constraint if it has a different resource" do
|
||||
new_resource = 'group2'
|
||||
|
@@ -30,18 +30,7 @@ describe "Chef::Provider::PacemakerMs" do
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
describe ":create action" do
|
||||
def test_modify(expected_cmds)
|
||||
yield
|
||||
|
||||
stub_shellout(fixture.definition_string)
|
||||
|
||||
provider.run_action :create
|
||||
|
||||
expected_cmds.each do |cmd|
|
||||
expect(@chef_run).to run_execute(cmd)
|
||||
end
|
||||
expect(@resource).to be_updated
|
||||
end
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
it "should modify the resource if it's changed" do
|
||||
expected = fixture.dup
|
||||
|
@@ -30,18 +30,7 @@ describe "Chef::Provider::PacemakerPrimitive" do
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
describe ":create action" do
|
||||
def test_modify(expected_cmds)
|
||||
yield
|
||||
|
||||
stub_shellout(fixture.definition_string)
|
||||
|
||||
provider.run_action :create
|
||||
|
||||
expected_cmds.each do |cmd|
|
||||
expect(@chef_run).to run_execute(cmd)
|
||||
end
|
||||
expect(@resource).to be_updated
|
||||
end
|
||||
include Chef::RSpec::Pacemaker::CIBObject
|
||||
|
||||
it "should modify the primitive if it has different params" do
|
||||
expected_configure_cmd_args = [
|
||||
|
Reference in New Issue
Block a user