X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=spec%2Fgraph%2Fgraph_spec.rb;h=09cc6a433cddd36d28d78fa4c09fc9f2542450da;hb=5d4c8249cc22f7fc6f784def527fb72535f61581;hp=ba7bea13cf1bcc87ddc3975736eb30f646e0223e;hpb=0908114d61c0effab6a568dd47053244df92cde8;p=graph.njae.git diff --git a/spec/graph/graph_spec.rb b/spec/graph/graph_spec.rb index ba7bea1..09cc6a4 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 @@ -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