Sha256: 167c4db805783aa7958ec9097bf0b80a5f7b695f110bfee1c2944fe9d007fe6b
Contents?: true
Size: 945 Bytes
Versions: 2
Compression:
Stored size: 945 Bytes
Contents
require 'rspec/expectations' module NcsNavigator::Mdes::Spec::Matchers class ValueDiffMatcher attr_reader :left, :right, :actual def initialize(left, right) @left = left @right = right end def left_matches?(actual) left == actual.left end def right_matches?(actual) right == actual.right end def matches?(actual) @actual = actual actual && left_matches?(actual) && right_matches?(actual) end def failure_message_for_should if (!actual) "expected a difference but got none" else [ ("expected left=#{left.inspect} but was #{actual.left.inspect}" unless left_matches?(actual)), ("expected right=#{right.inspect} but was #{actual.right.inspect}" unless right_matches?(actual)) ].compact.join(' and ') end end end def be_a_value_diff(left, right) ValueDiffMatcher.new(left, right) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ncs_mdes-0.13.0 | spec/differences_matchers.rb |
ncs_mdes-0.12.0 | spec/differences_matchers.rb |