X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=spec%2Fgraph%2Fvertex_spec.rb;fp=spec%2Fgraph%2Fvertex_spec.rb;h=e091289557143377b6f5c7923e3f156b0350ebe0;hb=95b8572d01c0b9c3aa8fc5a1e85a045c33d4ecf1;hp=b193bc81057558d24f9cf10ca7674937cb5d570d;hpb=32518a2c5089dbd3b9f74aad780ded127e3040ea;p=graph.njae.git diff --git a/spec/graph/vertex_spec.rb b/spec/graph/vertex_spec.rb index b193bc8..e091289 100644 --- a/spec/graph/vertex_spec.rb +++ b/spec/graph/vertex_spec.rb @@ -85,9 +85,16 @@ module GraphNjae e.vertices.should include(v) e.vertices.should include(v1) - e.should have(2).connections + e.should have(2).connections end + it "connects two vertices by an edge with attributes" do + v1 = Vertex.new + v1.id = :v1 + e = v.connect(v1, {:type => :edge_type}) + e.type.should == :edge_type + end + it "creates a self-connection" do e = v.connect v @@ -104,6 +111,11 @@ module GraphNjae e.should have(2).connections end + it "creates a self-connection with an edge with attributes" do + e = v.connect(v, {:type => :edge_type}) + e.type.should == :edge_type + end + end # #connect describe "#neighbours" do