1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
require 'dirgra-0.3.jar'
import 'org.jruby.dirgra.Edge'
import 'org.jruby.dirgra.Vertex'
import 'org.jruby.dirgra.DirectedGraph'
require 'vertex_id_helper'
describe "Edge" do
let(:graph) { DirectedGraph.new }
let(:foo) { VertexID.new(1) }
let(:bar) { VertexID.new(2) }
describe "toString" do
context "When edge type is not null" do
it "represents edge with type" do
edge = Edge.new(Vertex.new(graph, foo, 1), Vertex.new(graph, bar, 2), "baz")
expect(edge.toString).to eq "<1 --> 2> (baz)"
end
end
context "When edge type is null" do
it "represents edge without type" do
edge = Edge.new(Vertex.new(graph, foo, 1), Vertex.new(graph, bar, 2), nil)
expect(edge.toString).to eq "<1 --> 2>"
end
end
end
end
|