spec/undirected_graph_spec.rb in graphshaper-0.2.2 vs spec/undirected_graph_spec.rb in graphshaper-0.2.3
- old
+ new
@@ -1,6 +1,7 @@
require "spec_helper"
+require "graphshaper/undirected_graph"
describe Graphshaper::UndirectedGraph do
it "should create a graph with a given number of vertices and no edges" do
graph = Graphshaper::UndirectedGraph.new 5
graph.order.should ==(5)
@@ -66,22 +67,12 @@
@graph.degree_distribution.should ==[5]
@graph.add_edge 0,1
@graph.add_edge 1,2
@graph.degree_distribution.should ==[2,2,1]
end
- end
-
- describe "random generated graph without orphans" do
- before :each do
- @graph = Graphshaper::UndirectedGraph.without_orphans_with_order_of 15
- end
- it "should have the correct order" do
- @graph.order.should ==(15)
- end
-
- it "should have no orphans" do
- @graph.number_of_orphans.should ==(0)
+ it "should be able to connect all vertices" do
+ expect { @graph.connect_all_vertices }.to change{ @graph.number_of_orphans }.by(-5)
end
end
describe "calculating the vertex's degree and preferential attachment" do
before :each do
\ No newline at end of file