Permalink
Browse files

Test validation of graph separately from walking.

  • Loading branch information...
1 parent 6a48f5e commit dff1c03acebcd01e71107511ac205da10cbbbf44 @threedaymonk threedaymonk committed Mar 21, 2012
Showing with 48 additions and 40 deletions.
  1. +1 −40 test/graph_test.rb
  2. +47 −0 test/graph_validation_test.rb
View
@@ -1,7 +1,7 @@
require "common"
require "sibyl/graph"
-describe "Graph" do
+describe "Graph validation" do
def graph(source)
Sibyl::Graph.new(source)
end
@@ -19,43 +19,4 @@ def graph(source)
assert_equal expected, g.metadata
end
-
- it "should be valid" do
- g = graph(%{
- step number a
- go -> b
- outcome b
- })
-
- assert g.valid?
- end
-
- it "should be invalid if a step is unreachable" do
- g = graph(%{
- step number a
- go -> c
- step number b
- go -> c
- outcome c
- })
-
- refute g.valid?
- end
-
- it "should be invalid if a target is unresolved" do
- g = graph(%{
- step option a
- option foo -> b
- option bar -> c
- outcome b
- })
-
- refute g.valid?
- end
-
- it "should be invalid if there are no steps" do
- g = graph("")
-
- refute g.valid?
- end
end
@@ -0,0 +1,47 @@
+require "common"
+require "sibyl/graph"
+
+describe "Graph validation" do
+ def graph(source)
+ Sibyl::Graph.new(source)
+ end
+
+ it "should be valid" do
+ g = graph(%{
+ step number a
+ go -> b
+ outcome b
+ })
+
+ assert g.valid?
+ end
+
+ it "should be invalid if a step is unreachable" do
+ g = graph(%{
+ step number a
+ go -> c
+ step number b
+ go -> c
+ outcome c
+ })
+
+ refute g.valid?
+ end
+
+ it "should be invalid if a target is unresolved" do
+ g = graph(%{
+ step option a
+ option foo -> b
+ option bar -> c
+ outcome b
+ })
+
+ refute g.valid?
+ end
+
+ it "should be invalid if there are no steps" do
+ g = graph("")
+
+ refute g.valid?
+ end
+end

0 comments on commit dff1c03

Please sign in to comment.