Class: Xpect::EqualityHelpers

Inherits:
Object
  • Object
show all
Defined in:
lib/xpect/equality_helpers.rb

Class Method Summary collapse

Class Method Details

.equal?(val_1, val_2, path) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
# File 'lib/xpect/equality_helpers.rb', line 3

def self.equal?(val_1, val_2, path)
  unless val_1 == val_2
    raise FailedSpec, "'#{ val_1 }' is not equal to '#{ val_2 }' at '#{ path }'"
  end
end

.equal_with_proc?(fn, val, path) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
# File 'lib/xpect/equality_helpers.rb', line 9

def self.equal_with_proc?(fn, val, path)
  unless fn.call(val)
    raise FailedSpec, "'#{ val }' does not meet expectation at '#{ path }'"
  end
end