Sha256: b7808fac5eab27eeb8e0d5a3ad826b308710895249d8562cb3ce9dff296f0e19

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

require_relative 'setup_tests'
require_relative 'svg_graph'

module Tests
  class TestDogvizFunctionally < Test::Unit::TestCase

    def svg_outfile
      '/tmp/dogviz_functional_test.svg'
    end

    def setup
      File.delete svg_outfile if File.exist?(svg_outfile)
    end

    include Dogviz
    def test_outputs_svg_graph

      sys = System.new 'family'

      house = sys.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: 'respects'

      cat.points_to dog, name: 'chases'
      dog.points_to son, name: 'follows'

      sys.output svg: svg_outfile

      graph = SvgGraph.parse_file svg_outfile

      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', 'respects'], graph.names_of.edges
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dogviz-0.0.10 tests/test_dogviz_functionally.rb
dogviz-0.0.9 tests/test_dogviz_functionally.rb
dogviz-0.0.8 tests/test_dogviz_functionally.rb
dogviz-0.0.7 tests/test_dogviz_functionally.rb
dogviz-0.0.5 tests/test_dogviz_functionally.rb