class CheckPleaseRspecMatcher::Matcher
Attributes
actual[R]
expected[R]
flags[R]
Public Class Methods
new(expected, flags = {})
click to toggle source
# File lib/check_please_rspec_matcher/matcher.rb, line 12 def initialize(expected, flags = {}) @expected = expected @flags = flags || {} end
Public Instance Methods
failure_message()
click to toggle source
# File lib/check_please_rspec_matcher/matcher.rb, line 22 def failure_message diff_text = ::CheckPlease::Printers.render(diffs, flags) count = diffs.length == 1 ? "1 diff" : "#{diffs.length} diffs" <<~EOF Expected two JSON data structures to match, but found the following #{count}: #{diff_text} EOF end
matches?(actual)
click to toggle source
# File lib/check_please_rspec_matcher/matcher.rb, line 17 def matches?(actual) @actual = actual diffs.empty? end
Private Instance Methods
diffs()
click to toggle source
# File lib/check_please_rspec_matcher/matcher.rb, line 35 def diffs @_diffs ||= ::CheckPlease.diff(expected, actual, flags) end