avoid hardcoding usage of class under test
Hardcoding makes it more difficult to refactor common test code for reuse later on.
This commit is contained in:
@@ -38,7 +38,7 @@ describe Pacemaker::Resource::Clone do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should return a short definition string" do
|
it "should return a short definition string" do
|
||||||
clone = Pacemaker::Resource::Clone.new('foo')
|
clone = pacemaker_object_class.new('foo')
|
||||||
clone.definition = \
|
clone.definition = \
|
||||||
%!clone clone1 primitive1 meta globally-unique="true"!
|
%!clone clone1 primitive1 meta globally-unique="true"!
|
||||||
clone.parse_definition
|
clone.parse_definition
|
||||||
@@ -51,7 +51,7 @@ EOF
|
|||||||
|
|
||||||
describe "#parse_definition" do
|
describe "#parse_definition" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@parsed = Pacemaker::Resource::Clone.new(fixture.name)
|
@parsed = pacemaker_object_class.new(fixture.name)
|
||||||
@parsed.definition = fixture_definition
|
@parsed.definition = fixture_definition
|
||||||
@parsed.parse_definition
|
@parsed.parse_definition
|
||||||
end
|
end
|
||||||
|
@@ -38,7 +38,7 @@ describe Pacemaker::Resource::Group do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should return a short definition string" do
|
it "should return a short definition string" do
|
||||||
group = Pacemaker::Resource::Group.new('foo')
|
group = pacemaker_object_class.new('foo')
|
||||||
group.definition = \
|
group.definition = \
|
||||||
%!group foo member1 member2 meta target-role="Started"!
|
%!group foo member1 member2 meta target-role="Started"!
|
||||||
group.parse_definition
|
group.parse_definition
|
||||||
@@ -51,7 +51,7 @@ EOF
|
|||||||
|
|
||||||
describe "#parse_definition" do
|
describe "#parse_definition" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@parsed = Pacemaker::Resource::Group.new(fixture.name)
|
@parsed = pacemaker_object_class.new(fixture.name)
|
||||||
@parsed.definition = fixture_definition
|
@parsed.definition = fixture_definition
|
||||||
@parsed.parse_definition
|
@parsed.parse_definition
|
||||||
end
|
end
|
||||||
|
@@ -38,7 +38,7 @@ describe Pacemaker::Resource::MasterSlave do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should return a short definition string" do
|
it "should return a short definition string" do
|
||||||
ms = Pacemaker::Resource::MasterSlave.new('foo')
|
ms = pacemaker_object_class.new('foo')
|
||||||
ms.definition = \
|
ms.definition = \
|
||||||
%!ms ms1 primitive1 meta globally-unique="true"!
|
%!ms ms1 primitive1 meta globally-unique="true"!
|
||||||
ms.parse_definition
|
ms.parse_definition
|
||||||
@@ -51,7 +51,7 @@ EOF
|
|||||||
|
|
||||||
describe "#parse_definition" do
|
describe "#parse_definition" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@parsed = Pacemaker::Resource::MasterSlave.new(fixture.name)
|
@parsed = pacemaker_object_class.new(fixture.name)
|
||||||
@parsed.definition = fixture_definition
|
@parsed.definition = fixture_definition
|
||||||
@parsed.parse_definition
|
@parsed.parse_definition
|
||||||
end
|
end
|
||||||
|
@@ -78,7 +78,7 @@ describe Pacemaker::Resource::Primitive do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should return a short definition string" do
|
it "should return a short definition string" do
|
||||||
primitive = Pacemaker::Resource::Primitive.new('foo')
|
primitive = pacemaker_object_class.new('foo')
|
||||||
primitive.definition = \
|
primitive.definition = \
|
||||||
%!primitive foo ocf:heartbeat:IPaddr2 params foo="bar"!
|
%!primitive foo ocf:heartbeat:IPaddr2 params foo="bar"!
|
||||||
primitive.parse_definition
|
primitive.parse_definition
|
||||||
@@ -91,7 +91,7 @@ EOF
|
|||||||
|
|
||||||
describe "#quoted_definition_string" do
|
describe "#quoted_definition_string" do
|
||||||
it "should return the quoted definition string" do
|
it "should return the quoted definition string" do
|
||||||
primitive = Pacemaker::Resource::Primitive.new('foo')
|
primitive = pacemaker_object_class.new('foo')
|
||||||
primitive.definition = <<'EOF'.chomp
|
primitive.definition = <<'EOF'.chomp
|
||||||
primitive foo ocf:openstack:keystone \
|
primitive foo ocf:openstack:keystone \
|
||||||
params bar="baz\\qux" bar2="baz'qux"
|
params bar="baz\\qux" bar2="baz'qux"
|
||||||
@@ -106,7 +106,7 @@ EOF
|
|||||||
|
|
||||||
describe "#parse_definition" do
|
describe "#parse_definition" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@parsed = Pacemaker::Resource::Primitive.new(fixture.name)
|
@parsed = pacemaker_object_class.new(fixture.name)
|
||||||
@parsed.definition = fixture_definition
|
@parsed.definition = fixture_definition
|
||||||
@parsed.parse_definition
|
@parsed.parse_definition
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user