class EqualUtf16Matcher
Public Class Methods
new(expected)
click to toggle source
# File lib/mspec/matchers/equal_utf16.rb, line 4 def initialize(expected) @expected = Array(expected).map { |x| encode x, "binary" } end
Public Instance Methods
expected_swapped()
click to toggle source
# File lib/mspec/matchers/equal_utf16.rb, line 13 def expected_swapped @expected_swapped ||= @expected.map { |x| x.to_str.gsub(/(.)(.)/, '\2\1') } end
failure_message()
click to toggle source
# File lib/mspec/matchers/equal_utf16.rb, line 17 def failure_message ["Expected #{@actual.pretty_inspect}", "to equal #{@expected.pretty_inspect} or #{expected_swapped.pretty_inspect}"] end
matches?(actual)
click to toggle source
# File lib/mspec/matchers/equal_utf16.rb, line 8 def matches?(actual) @actual = Array(actual).map { |x| encode x, "binary" } @actual == @expected || @actual == expected_swapped end
negative_failure_message()
click to toggle source
# File lib/mspec/matchers/equal_utf16.rb, line 22 def negative_failure_message ["Expected #{@actual.pretty_inspect}", "not to equal #{@expected.pretty_inspect} nor #{expected_swapped.pretty_inspect}"] end