Sha256: 8f96cf194127ae9f489758d33c5c498703bda899ac3f269b2b98b6d002f4d0d1
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
require_relative 'setup_tests' require_relative 'svg_graph' module Tests class TestDogvizFunctionally < Test::Unit::TestCase def outfile(ext) "/tmp/dogviz_functional_test.#{ext}" end def read_outfile(ext) File.read outfile(ext) end def setup File.delete outfile('svg') if File.exist?(outfile('svg')) end include Dogviz class Family < Dogviz::System attr_reader *%i(cat dog mum son) def initialize super 'family' house = container 'household' @cat = house.thing 'cat' @dog = house.thing 'dog' @mum = house.thing 'mum' @son = house.thing 'son' mum.points_to son, name: 'parents' son.points_to mum, name: 'ignores' cat.points_to dog, name: 'chases' dog.points_to son, name: 'follows' end end def test_outputs_svg_graph sys = Family.new sys.output svg: outfile('svg') graph = SvgGraph.parse_file outfile('svg') assert_include graph.title, 'family' assert_equal ['household'], graph.names_of.containers assert_equal ['cat', 'dog', 'son', 'mum'], graph.names_of.things assert_equal ['chases', 'follows', 'parents', 'ignores'], graph.names_of.edges end def test_allows_rank_specification sys = Family.new sys.logical_container 'sinker', rank: 'sink' sys.output dot: outfile('dot') dotspec = File.read outfile('dot') assert_match /rank=sink/, dotspec end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dogviz-0.0.20 | tests/test_dogviz_functionally.rb |
dogviz-0.0.19 | tests/test_dogviz_functionally.rb |