Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 723977073b
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (34 sloc) 0.855 kb
require "common"
require "sibyl/graph"
describe "Graph validation" do
def graph(source)
Sibyl::Graph.new(source)
end
it "should translate a metadata line" do
g = graph(%{
metadata ivalue 1660
metadata svalue "foo bar"
})
expected = {
ivalue: 1660,
svalue: "foo bar"
}
assert_equal expected, g.metadata
end
it "should walk the nodes according to inputs" do
g = graph(%{
step multiple "Yes or no?"
option yes -> "How old are you?"
option no -> "Whatever"
step number "How old are you?"
go ->
if { input > 18 } -> "Adult"
otherwise -> "Child"
outcome "Whatever"
outcome "Adult"
outcome "Child"
})
assert_equal "How old are you?", g.at(["yes"]).name
assert_equal "Adult", g.at(["yes", 19]).name
end
end
Jump to Line
Something went wrong with that request. Please try again.