summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-12-11 00:07:20 -0600
committerLuke Kanies <luke@madstop.com>2007-12-11 00:07:20 -0600
commit3248c93f2fddf9b17148273af5dd5e2af2cb537b (patch)
tree9c5796942858e063d7cc05e040e878b81d2f39f2
parenta8bf74b9170b3cb27216f9755a39f635f748fc0a (diff)
downloadpuppet-3248c93f2fddf9b17148273af5dd5e2af2cb537b.tar.gz
puppet-3248c93f2fddf9b17148273af5dd5e2af2cb537b.tar.xz
puppet-3248c93f2fddf9b17148273af5dd5e2af2cb537b.zip
Fixing #937 -- I had not ported the dot methods at all,
and I had to make a few small changes to make them work.
-rw-r--r--lib/puppet/simple_graph.rb4
-rwxr-xr-xspec/unit/simple_graph.rb12
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb
index 48bf4991e..c9920e60a 100644
--- a/lib/puppet/simple_graph.rb
+++ b/lib/puppet/simple_graph.rb
@@ -212,7 +212,7 @@ class Puppet::SimpleGraph
params = {'name' => '"'+name+'"',
'fontsize' => fontsize,
'label' => name}
- v_label = vertex_label(v)
+ v_label = v.to_s
params.merge!(v_label) if v_label and v_label.kind_of? Hash
graph << DOT::DOTNode.new(params)
end
@@ -220,7 +220,7 @@ class Puppet::SimpleGraph
params = {'from' => '"'+ e.source.to_s + '"',
'to' => '"'+ e.target.to_s + '"',
'fontsize' => fontsize }
- e_label = edge_label(e)
+ e_label = e.to_s
params.merge!(e_label) if e_label and e_label.kind_of? Hash
graph << edge_klass.new(params)
end
diff --git a/spec/unit/simple_graph.rb b/spec/unit/simple_graph.rb
index b9d939867..88873663c 100755
--- a/spec/unit/simple_graph.rb
+++ b/spec/unit/simple_graph.rb
@@ -23,6 +23,13 @@ describe Puppet::SimpleGraph do
@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)
+
+ proc { @graph.to_dot_graph }.should_not raise_error
+ end
end
describe Puppet::SimpleGraph, " when managing vertices" do
@@ -220,8 +227,3 @@ describe Puppet::SimpleGraph, " when reversing graphs" do
edge.label.should == {:stuff => :awesome}
end
end
-
-describe Puppet::SimpleGraph, " when making DOT files" do
- # LAK:FIXME yay
- it "should have tests"
-end