Permalink
Browse files

Add to_dot method and test Node [] delegation

  • Loading branch information...
1 parent 9ab3554 commit f7a387889ca7f5ab4ebb67e3e5fb46eed515c33f @hallelujah committed Aug 27, 2010
Showing with 13 additions and 0 deletions.
  1. +4 −0 lib/sower/node.rb
  2. +9 −0 test/test_node.rb
View
@@ -35,6 +35,10 @@ def edges(graph,direction = :both)
a
end
+ def to_dot
+ "<id> #{identity}||<text> #{statement.to_sql}"
+ end
+
class << self
# Determine identity of a node
# identity_or_node can be a Hash, String or Node
View
@@ -32,6 +32,15 @@ def setup
assert_equal [Sower::Edge.new(tail,head), Sower::Edge.new(other_tail,tail)],tail.edges(graph,:both)
end
+ should "respond to []" do
+ assert_respond_to @node, :[]
+ assert_instance_of Sower::Relation::Attribute, @node[:id]
+ end
+
+ should "respond to statement" do
+ assert_respond_to @node, :statement
+ end
+
end
context "Node class" do

0 comments on commit f7a3878

Please sign in to comment.