Class: ErgomentumRspec::Matchers::Array::StrictlyIncreasing
- Inherits:
-
Object
- Object
- ErgomentumRspec::Matchers::Array::StrictlyIncreasing
- Defined in:
- lib/ergomentum_rspec/matchers/array/be_strictly_increasing.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
- #matches?(actual) ⇒ Boolean
Instance Method Details
#description ⇒ Object
25 26 27 |
# File 'lib/ergomentum_rspec/matchers/array/be_strictly_increasing.rb', line 25 def description "be strictly increasing" end |
#failure_message ⇒ Object
17 18 19 |
# File 'lib/ergomentum_rspec/matchers/array/be_strictly_increasing.rb', line 17 def "expected array #{@actual.inspect} to be strictly increasing" end |
#failure_message_when_negated ⇒ Object
21 22 23 |
# File 'lib/ergomentum_rspec/matchers/array/be_strictly_increasing.rb', line 21 def "expected array #{@actual.inspect} to not be strictly increasing" end |
#matches?(actual) ⇒ Boolean
11 12 13 14 15 |
# 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 |