test/lib/railroady/diagram_graph_spec.rb in railroady-1.3.0 vs test/lib/railroady/diagram_graph_spec.rb in railroady-1.3.1
- old
+ new
@@ -3,23 +3,27 @@
module CustomDotMatchers
class HaveDotOptions
def initialize(expected)
@expected = expected
end
+
def matches?(target)
@target = target
return false unless @target =~ /\[(.*)\]/
- @options = $1
+ @options = Regexp.last_match(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"
+ 'have dot options'
end
end
def have_dot_options(expected)
HaveDotOptions.new expected
end