class UnequalAssay

UnequalAssay compares objects with ‘#!=` operator. Yes, as of Ruby 1.9 the `!=` is a redefinable method, and as such, we need a separate assay to cover it.

Public Class Methods

assert_message(subject, criterion) click to toggle source

Failed assertion message.

# File lib/assay/unequal_assay.rb, line 21
def self.assert_message(subject, criterion)
  a = subject.inspect
  b = criterion.inspect

  if a.size > SIZE_LIMIT or b.size > SIZE_LIMIT
    if $ansi
      d = ANSI::Diff.new(a, b)
      a, b = d.diff1, d.diff2  # *d.to_a
    end
    "a != b\na) #{a}\nb) #{b}"
  else
    "#{a} != #{b}"
  end
end
pass?(subject, criterion) click to toggle source

Check assertion using ‘#!=` method.

# File lib/assay/unequal_assay.rb, line 14
def self.pass?(subject, criterion)
  subject != criterion
end