Sha256: 115072a8f279cd58fc73b329f8bacba3f23a2a7e75bb80a4862b1fe18558945b

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')

module CustomDotMatchers
  class HaveDotOptions
    def initialize(expected)
      @expected = expected
    end
    def matches?(target)
      @target = target
      return false unless @target =~ /\[(.*)\]/
      @options = $1
      @options == @expected
    end
    def failure_message
      "expected '#{@target.strip}' to have options '[#{@expected}]'"
    end
    def negative_failure_message
      "expected '#{@target.strip}' to not have options '[#{@expected}]'"
    end
    def description
      "have dot options"
    end
  end
  def have_dot_options(expected)
    HaveDotOptions.new expected
  end
end

describe DiagramGraph do
  include CustomDotMatchers

  before do
    @diagram_graph = DiagramGraph.new
  end

  # describe ".dot_edge" do
  #   context "has_a/belongs_to" do
  #     it { @diagram_graph.send(:dot_edge, "one-one", "source", "target").must_include "arrowtail=odot, arrowhead=dot, dir=both" }
  #   end

  #   context "has_many/belongs_to" do
  #     it { @diagram_graph.send(:dot_edge, "one-many", "source", "target").must_include "arrowtail=odot, arrowhead=crow, dir=both" }
  #   end

  #   context "habtm" do
  #     it { @diagram_graph.send(:dot_edge, "many-many", "source", "target").must_include "arrowtail=crow, arrowhead=crow, dir=both" }
  #   end
  # end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
railroady-1.3.0 test/lib/railroady/diagram_graph_spec.rb