class ErgomentumRspec::Matchers::Array::StrictlyIncreasing

Public Instance Methods

description() click to toggle source
# File lib/ergomentum_rspec/matchers/array/be_strictly_increasing.rb, line 25
def description
  "be strictly increasing"
end
failure_message() click to toggle source
# File lib/ergomentum_rspec/matchers/array/be_strictly_increasing.rb, line 17
def failure_message
  "expected array #{@actual.inspect} to be strictly increasing"
end
failure_message_when_negated() click to toggle source
# File lib/ergomentum_rspec/matchers/array/be_strictly_increasing.rb, line 21
def failure_message_when_negated
  "expected array #{@actual.inspect} to not be strictly increasing"
end
matches?(actual) click to toggle source
# File lib/ergomentum_rspec/matchers/array/be_strictly_increasing.rb, line 11
def matches?(actual)
  @actual = actual
  derivative = actual.each_cons(2).map { |x, y| y <=> x }
  derivative.all?(&:positive?)
end