move duplicated test_modify to Chef::RSpec::Pacemaker::CIBObject

This commit is contained in:
Adam Spiers
2014-03-22 14:27:08 +00:00
parent 387641f59b
commit 8e8127625d
7 changed files with 25 additions and 72 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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'

View File

@@ -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

View File

@@ -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'

View File

@@ -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

View File

@@ -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 = [