cookbook-pacemaker/spec/providers/clone_spec.rb

47 lines
1.1 KiB
Ruby

require 'spec_helper'
this_dir = File.dirname(__FILE__)
require File.expand_path('../helpers/runnable_resource', this_dir)
require File.expand_path('../fixtures/clone_resource', this_dir)
describe "Chef::Provider::PacemakerClone" do
# for use inside examples:
let(:fixture) { Chef::RSpec::Pacemaker::Config::CLONE_RESOURCE.dup }
# for use outside examples (e.g. when invoking shared_examples)
fixture = Chef::RSpec::Pacemaker::Config::CLONE_RESOURCE.dup
def lwrp_name
'clone'
end
include_context "a Pacemaker LWRP"
before(:each) do
@resource.rsc fixture.rsc.dup
@resource.meta Hash[fixture.meta.dup]
end
def cib_object_class
Pacemaker::Resource::Clone
end
describe ":create action" do
include Chef::RSpec::Pacemaker::CIBObject
it "should modify the clone if the resource is changed" do
expected = fixture.dup
expected.rsc = 'primitive2'
expected_configure_cmd_args = [expected.reconfigure_command]
test_modify(expected_configure_cmd_args) do
@resource.rsc expected.rsc
end
end
end
it_should_behave_like "a runnable resource", fixture
end