extend Pacemaker::Constraint::Colocation tests

This commit is contained in:
Adam Spiers 2014-03-21 18:01:15 +00:00
parent 233681f73a
commit f6d054fadc

View File

@ -6,6 +6,9 @@ require File.expand_path('../../../helpers/cib_object', File.dirname(__FILE__))
describe Pacemaker::Constraint::Colocation do
let(:fixture) { Chef::RSpec::Pacemaker::Config::COLOCATION_CONSTRAINT.dup }
let(:fixture_definition) {
Chef::RSpec::Pacemaker::Config::COLOCATION_CONSTRAINT_DEFINITION
}
before(:each) do
Mixlib::ShellOut.any_instance.stub(:run_command)
@ -24,4 +27,37 @@ describe Pacemaker::Constraint::Colocation do
end
it_should_behave_like "a CIB object"
describe "#definition_string" do
it "should return the definition string" do
expect(fixture.definition_string).to eq(fixture_definition)
end
it "should return a short definition string" do
colocation = pacemaker_object_class.new('foo')
colocation.definition = \
%!colocation colocation1 -inf: rsc1 rsc2!
colocation.parse_definition
expect(colocation.definition_string).to eq(<<'EOF'.chomp)
colocation colocation1 -inf: rsc1 rsc2
EOF
end
end
describe "#parse_definition" do
before(:each) do
@parsed = pacemaker_object_class.new(fixture.name)
@parsed.definition = fixture_definition
@parsed.parse_definition
end
it "should parse the score" do
expect(@parsed.score).to eq(fixture.score)
end
it "should parse the resources" do
expect(@parsed.resources).to eq(fixture.resources)
end
end
end