X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=spec%2Fgraph%2Fgraph_spec.rb;h=09cc6a433cddd36d28d78fa4c09fc9f2542450da;hb=5d0d968af54bf21b892c25074a9ca452604bb210;hp=7227a6f8e1abdf60b25efe5bc419ca2c8a861ba4;hpb=624e339a169bd96eb01da7288a8904e0d1830e42;p=graph.njae.git diff --git a/spec/graph/graph_spec.rb b/spec/graph/graph_spec.rb index 7227a6f..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 Graph +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 Graph 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