X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=spec%2Fgraph%2Fgraph_spec.rb;h=d92562e139e46401ad19116f417fb41ed2f23e7a;hb=c065008f95cd701f151e8f991caa3fb5dd019049;hp=ba7bea13cf1bcc87ddc3975736eb30f646e0223e;hpb=0908114d61c0effab6a568dd47053244df92cde8;p=graph.njae.git diff --git a/spec/graph/graph_spec.rb b/spec/graph/graph_spec.rb index ba7bea1..d92562e 100644 --- a/spec/graph/graph_spec.rb +++ b/spec/graph/graph_spec.rb @@ -1,6 +1,13 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') module GraphNjae + + class SVertex < Vertex + end + + class SEdge < Edge + end + describe Graph do let (:g) { Graph.new } describe "#initialize" do @@ -14,7 +21,7 @@ module GraphNjae describe "adds attribues" do it "adds then reports arbitrary attributes" do g.score = 15 - g.score == 15 + g.score.should == 15 end end # adds attributes @@ -54,6 +61,16 @@ module GraphNjae g.edges.should include(e1) g.edges.should include(e2) end + + it "adds a subclass of Vertex" do + g.vertices.should be_empty + v1 = SVertex.new + v2 = SVertex.new + g << v1 << v2 + g.should have(2).vertices + g.vertices.should include(v1) + g.vertices.should include(v2) + end end # #<< describe "connect" do