class ErgomentumRspec::Matchers::Array::MonotonicallyIncreasing
Public Instance Methods
description()
click to toggle source
# File lib/ergomentum_rspec/matchers/array/be_monotonically_increasing.rb, line 25 def description "be monotonically increasing" end
failure_message()
click to toggle source
# File lib/ergomentum_rspec/matchers/array/be_monotonically_increasing.rb, line 17 def failure_message "expected array #{@actual.inspect} to be monotonically increasing" end
failure_message_when_negated()
click to toggle source
# File lib/ergomentum_rspec/matchers/array/be_monotonically_increasing.rb, line 21 def failure_message_when_negated "expected array #{@actual.inspect} to not be monotonically increasing" end
matches?(actual)
click to toggle source
# File lib/ergomentum_rspec/matchers/array/be_monotonically_increasing.rb, line 11 def matches?(actual) @actual = actual derivative = actual.each_cons(2).map { |x, y| y <=> x } derivative.all? { |v| v >= 0 } end