summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-02-11 18:27:49 -0600
committerLuke Kanies <luke@madstop.com>2008-02-11 18:27:49 -0600
commit8b2fae019b31513becd002eb474e1b4803abde24 (patch)
tree92312a50927ff65a8b78fbec7fff52d3bf59eb78 /spec/unit
parentcf21ade9abf4541920b535b0e2643b30e44b067b (diff)
downloadpuppet-8b2fae019b31513becd002eb474e1b4803abde24.tar.gz
puppet-8b2fae019b31513becd002eb474e1b4803abde24.tar.xz
puppet-8b2fae019b31513becd002eb474e1b4803abde24.zip
Removing the last remaining vestiges of GRATR --
removing the bangs from 'add_vertex!' and 'add_edge!'.
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/node/catalog.rb48
-rwxr-xr-xspec/unit/other/pgraph.rb34
-rwxr-xr-xspec/unit/ral/type.rb4
-rwxr-xr-xspec/unit/simple_graph.rb64
4 files changed, 75 insertions, 75 deletions
diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb
index a0e201ca9..aa49909e2 100755
--- a/spec/unit/node/catalog.rb
+++ b/spec/unit/node/catalog.rb
@@ -75,7 +75,7 @@ describe Puppet::Node::Catalog, " when extracting transobjects" do
@source = mock 'source'
main = mkresource("class", :main)
- config.add_vertex!(main)
+ config.add_vertex(main)
bucket = mock 'bucket'
bucket.expects(:classes=).with(config.classes)
@@ -95,7 +95,7 @@ describe Puppet::Node::Catalog, " when extracting transobjects" do
defined = mkresource("class", :main)
builtin = mkresource("file", "/yay")
- config.add_edge!(defined, builtin)
+ config.add_edge(defined, builtin)
bucket = []
bucket.expects(:classes=).with(config.classes)
@@ -121,21 +121,21 @@ describe Puppet::Node::Catalog, " when extracting transobjects" do
top.expects(:to_trans).returns(topbucket)
topres = mkresource "file", "/top"
topres.expects(:to_trans).returns(:topres)
- config.add_edge! top, topres
+ config.add_edge top, topres
middle = mkresource "class", "middle"
middle.expects(:to_trans).returns([])
- config.add_edge! top, middle
+ config.add_edge top, middle
midres = mkresource "file", "/mid"
midres.expects(:to_trans).returns(:midres)
- config.add_edge! middle, midres
+ config.add_edge middle, midres
bottom = mkresource "class", "bottom"
bottom.expects(:to_trans).returns([])
- config.add_edge! middle, bottom
+ config.add_edge middle, bottom
botres = mkresource "file", "/bot"
botres.expects(:to_trans).returns(:botres)
- config.add_edge! bottom, botres
+ config.add_edge bottom, botres
toparray = config.extract_to_transportable
@@ -196,13 +196,13 @@ describe Puppet::Node::Catalog, " when converting to a transobject catalog" do
@resources = [@top, @topobject, @middle, @middleobject, @bottom, @bottomobject]
- @original.add_edge!(@top, @topobject)
- @original.add_edge!(@top, @virtual)
- @original.add_edge!(@virtual, @virtualobject)
- @original.add_edge!(@top, @middle)
- @original.add_edge!(@middle, @middleobject)
- @original.add_edge!(@middle, @bottom)
- @original.add_edge!(@bottom, @bottomobject)
+ @original.add_edge(@top, @topobject)
+ @original.add_edge(@top, @virtual)
+ @original.add_edge(@virtual, @virtualobject)
+ @original.add_edge(@top, @middle)
+ @original.add_edge(@middle, @middleobject)
+ @original.add_edge(@middle, @bottom)
+ @original.add_edge(@bottom, @bottomobject)
@catalog = @original.to_transportable
end
@@ -261,11 +261,11 @@ describe Puppet::Node::Catalog, " when converting to a RAL catalog" do
@original.add_resource(*@resources)
- @original.add_edge!(@top, @topobject)
- @original.add_edge!(@top, @middle)
- @original.add_edge!(@middle, @middleobject)
- @original.add_edge!(@middle, @bottom)
- @original.add_edge!(@bottom, @bottomobject)
+ @original.add_edge(@top, @topobject)
+ @original.add_edge(@top, @middle)
+ @original.add_edge(@middle, @middleobject)
+ @original.add_edge(@middle, @bottom)
+ @original.add_edge(@bottom, @bottomobject)
@catalog = @original.to_ral
end
@@ -300,7 +300,7 @@ describe Puppet::Node::Catalog, " when converting to a RAL catalog" do
config.add_resource(changer)
config.add_resource(@top)
- config.add_edge!(@top, changer)
+ config.add_edge(@top, changer)
resource = stub 'resource', :name => "changer2", :title => "changer2", :ref => "Test[changer2]", :catalog= => nil, :remove => nil
@@ -597,8 +597,8 @@ describe Puppet::Node::Catalog, " when creating a relationship graph" do
@file = Puppet::Type.type(:file)
@one = @file.create :path => "/one"
@two = @file.create :path => "/two"
- @catalog.add_edge! @compone, @one
- @catalog.add_edge! @comptwo, @two
+ @catalog.add_edge @compone, @one
+ @catalog.add_edge @comptwo, @two
@three = @file.create :path => "/three"
@four = @file.create :path => "/four", :require => ["file", "/three"]
@@ -771,7 +771,7 @@ end
describe Puppet::Node::Catalog, " when converting to yaml" do
before do
@catalog = Puppet::Node::Catalog.new("me")
- @catalog.add_edge!("one", "two")
+ @catalog.add_edge("one", "two")
end
it "should be able to be dumped to yaml" do
@@ -782,7 +782,7 @@ end
describe Puppet::Node::Catalog, " when converting from yaml" do
before do
@catalog = Puppet::Node::Catalog.new("me")
- @catalog.add_edge!("one", "two")
+ @catalog.add_edge("one", "two")
text = YAML.dump(@catalog)
@newcatalog = YAML.load(text)
diff --git a/spec/unit/other/pgraph.rb b/spec/unit/other/pgraph.rb
index 252a807ec..7d66ae331 100755
--- a/spec/unit/other/pgraph.rb
+++ b/spec/unit/other/pgraph.rb
@@ -35,8 +35,8 @@ describe Puppet::PGraph do
end
it "should correctly clear vertices and edges when asked" do
- @graph.add_edge!("a", "b")
- @graph.add_vertex! "c"
+ @graph.add_edge("a", "b")
+ @graph.add_vertex "c"
@graph.clear
@graph.vertices.should be_empty
@graph.edges.should be_empty
@@ -52,7 +52,7 @@ describe Puppet::PGraph, " when matching edges" do
@edges = {}
@edges["a/b"] = Puppet::Relationship.new("a", "b", {:event => :yay, :callback => :refresh})
@edges["a/c"] = Puppet::Relationship.new("a", "c", {:event => :yay, :callback => :refresh})
- @graph.add_edge!(@edges["a/b"])
+ @graph.add_edge(@edges["a/b"])
end
it "should match edges whose source matches the source of the event" do
@@ -64,7 +64,7 @@ describe Puppet::PGraph, " when matching edges" do
end
it "should match multiple edges" do
- @graph.add_edge!(@edges["a/c"])
+ @graph.add_edge(@edges["a/c"])
edges = @graph.matching_edges([@event])
edges.should be_include(@edges["a/b"])
edges.should be_include(@edges["a/c"])
@@ -75,9 +75,9 @@ describe Puppet::PGraph, " when determining dependencies" do
before do
@graph = Puppet::PGraph.new
- @graph.add_edge!("a", "b")
- @graph.add_edge!("a", "c")
- @graph.add_edge!("b", "d")
+ @graph.add_edge("a", "b")
+ @graph.add_edge("a", "c")
+ @graph.add_edge("b", "d")
end
it "should find all dependents when they are on multiple levels" do
@@ -118,19 +118,19 @@ describe Puppet::PGraph, " when splicing the relationship graph" do
# We have to add the container to the main graph, else it won't
# be spliced in the dependency graph.
- @contgraph.add_vertex!(@empty)
+ @contgraph.add_vertex(@empty)
end
def dependency_graph
@depgraph = Puppet::PGraph.new
@contgraph.vertices.each do |v|
- @depgraph.add_vertex!(v)
+ @depgraph.add_vertex(v)
end
# We have to specify a relationship to our empty container, else it
# never makes it into the dep graph in the first place.
{@one => @two, "f" => "c", "h" => @middle, "c" => @empty}.each do |source, target|
- @depgraph.add_edge!(source, target, :callback => :refresh)
+ @depgraph.add_edge(source, target, :callback => :refresh)
end
end
@@ -176,13 +176,13 @@ describe Puppet::PGraph, " when splicing the relationship graph" do
end
it "should not add labels to edges that have none" do
- @depgraph.add_edge!(@two, @three)
+ @depgraph.add_edge(@two, @three)
splice
@depgraph.edge_label("c", "i").should == {}
end
it "should copy labels over edges that have none" do
- @depgraph.add_edge!("c", @three, {:callback => :refresh})
+ @depgraph.add_edge("c", @three, {:callback => :refresh})
splice
# And make sure the label got copied.
@depgraph.edge_label("c", "i").should == {:callback => :refresh}
@@ -190,18 +190,18 @@ describe Puppet::PGraph, " when splicing the relationship graph" do
it "should not replace a label with a nil label" do
# Lastly, add some new label-less edges and make sure the label stays.
- @depgraph.add_edge!(@middle, @three)
- @depgraph.add_edge!("c", @three, {:callback => :refresh})
+ @depgraph.add_edge(@middle, @three)
+ @depgraph.add_edge("c", @three, {:callback => :refresh})
splice
@depgraph.edge_label("c", "i").should == {:callback => :refresh}
end
it "should copy labels to all created edges" do
- @depgraph.add_edge!(@middle, @three)
- @depgraph.add_edge!("c", @three, {:callback => :refresh})
+ @depgraph.add_edge(@middle, @three)
+ @depgraph.add_edge("c", @three, {:callback => :refresh})
splice
@three.each do |child|
- edge = @depgraph.edge_class.new("c", child)
+ edge = Puppet::Relationship.new("c", child)
@depgraph.should be_edge(edge.source, edge.target)
@depgraph.edge_label(edge.source, edge.target).should == {:callback => :refresh}
end
diff --git a/spec/unit/ral/type.rb b/spec/unit/ral/type.rb
index 25f8cbaf1..5980167d6 100755
--- a/spec/unit/ral/type.rb
+++ b/spec/unit/ral/type.rb
@@ -11,8 +11,8 @@ describe Puppet::Type, " when in a configuration" do
@catalog.add_resource @container
@catalog.add_resource @one
@catalog.add_resource @two
- @catalog.add_edge! @container, @one
- @catalog.add_edge! @container, @two
+ @catalog.add_edge @container, @one
+ @catalog.add_edge @container, @two
end
it "should have no parent if there is no in edge" do
diff --git a/spec/unit/simple_graph.rb b/spec/unit/simple_graph.rb
index 061a07458..c8fe14cf3 100755
--- a/spec/unit/simple_graph.rb
+++ b/spec/unit/simple_graph.rb
@@ -9,8 +9,8 @@ require 'puppet/simple_graph'
describe Puppet::SimpleGraph do
it "should return the number of its vertices as its length" do
@graph = Puppet::SimpleGraph.new
- @graph.add_vertex!("one")
- @graph.add_vertex!("two")
+ @graph.add_vertex("one")
+ @graph.add_vertex("two")
@graph.size.should == 2
end
@@ -20,13 +20,13 @@ describe Puppet::SimpleGraph do
it "should provide a method for reversing the graph" do
@graph = Puppet::SimpleGraph.new
- @graph.add_edge!(:one, :two)
+ @graph.add_edge(:one, :two)
@graph.reversal.edge?(:two, :one).should be_true
end
it "should be able to produce a dot graph" do
@graph = Puppet::SimpleGraph.new
- @graph.add_edge!(:one, :two)
+ @graph.add_edge(:one, :two)
proc { @graph.to_dot_graph }.should_not raise_error
end
@@ -38,17 +38,17 @@ describe Puppet::SimpleGraph, " when managing vertices" do
end
it "should provide a method to add a vertex" do
- @graph.add_vertex!(:test)
+ @graph.add_vertex(:test)
@graph.vertex?(:test).should be_true
end
it "should ignore already-present vertices when asked to add a vertex" do
- @graph.add_vertex!(:test)
- proc { @graph.add_vertex!(:test) }.should_not raise_error
+ @graph.add_vertex(:test)
+ proc { @graph.add_vertex(:test) }.should_not raise_error
end
it "should return true when asked if a vertex is present" do
- @graph.add_vertex!(:test)
+ @graph.add_vertex(:test)
@graph.vertex?(:test).should be_true
end
@@ -57,15 +57,15 @@ describe Puppet::SimpleGraph, " when managing vertices" do
end
it "should return all set vertices when asked" do
- @graph.add_vertex!(:one)
- @graph.add_vertex!(:two)
+ @graph.add_vertex(:one)
+ @graph.add_vertex(:two)
@graph.vertices.length.should == 2
@graph.vertices.should include(:one)
@graph.vertices.should include(:two)
end
it "should remove a given vertex when asked" do
- @graph.add_vertex!(:one)
+ @graph.add_vertex(:one)
@graph.remove_vertex!(:one)
@graph.vertex?(:one).should be_false
end
@@ -86,49 +86,49 @@ describe Puppet::SimpleGraph, " when managing edges" do
it "should provide a method to add an edge as an instance of the edge class" do
edge = Puppet::Relationship.new(:one, :two)
- @graph.add_edge!(edge)
+ @graph.add_edge(edge)
@graph.edge?(:one, :two).should be_true
end
it "should provide a method to add an edge by specifying the two vertices" do
- @graph.add_edge!(:one, :two)
+ @graph.add_edge(:one, :two)
@graph.edge?(:one, :two).should be_true
end
it "should provide a method to add an edge by specifying the two vertices and a label" do
- @graph.add_edge!(:one, :two, :stuff => :awesome)
+ @graph.add_edge(:one, :two, :stuff => :awesome)
@graph.edge?(:one, :two).should be_true
end
it "should provide a method for retrieving an edge label" do
edge = Puppet::Relationship.new(:one, :two, :stuff => :awesome)
- @graph.add_edge!(edge)
+ @graph.add_edge(edge)
@graph.edge_label(:one, :two).should == {:stuff => :awesome}
end
it "should provide a method for retrieving an edge" do
edge = Puppet::Relationship.new(:one, :two)
- @graph.add_edge!(edge)
+ @graph.add_edge(edge)
@graph.edge(:one, :two).should equal(edge)
end
it "should add the edge source as a vertex if it is not already" do
edge = Puppet::Relationship.new(:one, :two)
- @graph.add_edge!(edge)
+ @graph.add_edge(edge)
@graph.vertex?(:one).should be_true
end
it "should add the edge target as a vertex if it is not already" do
edge = Puppet::Relationship.new(:one, :two)
- @graph.add_edge!(edge)
+ @graph.add_edge(edge)
@graph.vertex?(:two).should be_true
end
it "should return all edges as edge instances when asked" do
one = Puppet::Relationship.new(:one, :two)
two = Puppet::Relationship.new(:two, :three)
- @graph.add_edge!(one)
- @graph.add_edge!(two)
+ @graph.add_edge(one)
+ @graph.add_edge(two)
edges = @graph.edges
edges.length.should == 2
edges.should include(one)
@@ -137,7 +137,7 @@ describe Puppet::SimpleGraph, " when managing edges" do
it "should remove an edge when asked" do
edge = Puppet::Relationship.new(:one, :two)
- @graph.add_edge!(edge)
+ @graph.add_edge(edge)
@graph.remove_edge!(edge)
@graph.edge?(edge.source, edge.target).should be_false
end
@@ -145,8 +145,8 @@ describe Puppet::SimpleGraph, " when managing edges" do
it "should remove all related edges when a vertex is removed" do
one = Puppet::Relationship.new(:one, :two)
two = Puppet::Relationship.new(:two, :three)
- @graph.add_edge!(one)
- @graph.add_edge!(two)
+ @graph.add_edge(one)
+ @graph.add_edge(two)
@graph.remove_vertex!(:two)
@graph.edge?(:one, :two).should be_false
@graph.edge?(:two, :three).should be_false
@@ -160,9 +160,9 @@ describe Puppet::SimpleGraph, " when finding adjacent vertices" do
@one_two = Puppet::Relationship.new(:one, :two)
@two_three = Puppet::Relationship.new(:two, :three)
@one_three = Puppet::Relationship.new(:one, :three)
- @graph.add_edge!(@one_two)
- @graph.add_edge!(@one_three)
- @graph.add_edge!(@two_three)
+ @graph.add_edge(@one_two)
+ @graph.add_edge(@one_three)
+ @graph.add_edge(@two_three)
end
it "should return adjacent vertices" do
@@ -193,8 +193,8 @@ describe Puppet::SimpleGraph, " when clearing" do
@graph = Puppet::SimpleGraph.new
one = Puppet::Relationship.new(:one, :two)
two = Puppet::Relationship.new(:two, :three)
- @graph.add_edge!(one)
- @graph.add_edge!(two)
+ @graph.add_edge(one)
+ @graph.add_edge(two)
@graph.clear
end
@@ -214,18 +214,18 @@ describe Puppet::SimpleGraph, " when reversing graphs" do
end
it "should provide a method for reversing the graph" do
- @graph.add_edge!(:one, :two)
+ @graph.add_edge(:one, :two)
@graph.reversal.edge?(:two, :one).should be_true
end
it "should add all vertices to the reversed graph" do
- @graph.add_edge!(:one, :two)
+ @graph.add_edge(:one, :two)
@graph.vertex?(:one).should be_true
@graph.vertex?(:two).should be_true
end
it "should retain labels on edges" do
- @graph.add_edge!(:one, :two, :stuff => :awesome)
+ @graph.add_edge(:one, :two, :stuff => :awesome)
edge = @graph.reversal.edge(:two, :one)
edge.label.should == {:stuff => :awesome}
end
@@ -238,7 +238,7 @@ describe Puppet::SimpleGraph, " when sorting the graph" do
def add_edges(hash)
hash.each do |a,b|
- @graph.add_edge!(a, b)
+ @graph.add_edge(a, b)
end
end