move Pacemaker::CIBObject.from_name test to libraries/primitive_spec

This commit is contained in:
Adam Spiers 2014-01-29 14:58:42 +00:00
parent 4df1f5c40f
commit d4b8b6432d
2 changed files with 10 additions and 7 deletions

View File

@ -68,13 +68,6 @@ describe Pacemaker::CIBObject do
end
end
end
describe "::from_name" do
it "should instantiate a Pacemaker::Resource::Primitive" do
obj = Pacemaker::CIBObject.from_name(cib_object.name)
expect(obj.is_a? Pacemaker::Resource::Primitive).to be_true
end
end
end
context "CIB object with unregistered type" do

View File

@ -8,6 +8,16 @@ describe Pacemaker::Resource::Primitive do
Mixlib::ShellOut.any_instance.stub(:run_command)
end
it "should be instantiated via Pacemaker::CIBObject.from_name" do
Mixlib::ShellOut.any_instance.stub(:error!)
expect_any_instance_of(Mixlib::ShellOut) \
.to receive(:stdout) \
.and_return(@primitive.definition_string)
obj = Pacemaker::CIBObject.from_name(@primitive.name)
expect(obj.is_a? Pacemaker::Resource::Primitive).to be_true
end
it "should barf if the loaded definition's type is not primitive" do
Mixlib::ShellOut.any_instance.stub(:error!)
expect_any_instance_of(Mixlib::ShellOut) \