NDD RSpec

Build Status Dependency Status Code Climate Test Coverage Documentation Coverage Yard Documentation

RSpec utilities.

The API documentation can be find at RubyDoc.

Prerequisites

This gem requires RSpec 3.1 and is tested with:

  • Ruby 1.9.3
  • Ruby 2.0.0
  • Ruby 2.1.x

Matchers

be_sorted_by

expect([1, 2, 3]).to be_sorted_by(:to_i)  # => success
expect([1, 3, 2]).to be_sorted_by(:to_i)  # => failure

Duck = Struct.new(:color)
expect([Duck.new('Grey'), Duck.new('White')]).to be_sorted_by(:color) }  # => success
expect([Duck.new('White'), Duck.new('Grey')]).to be_sorted_by(:color) }  # => failure

be_reverse_sorted_by

expect([3, 2, 1]).to be_reverse_sorted_by(:to_i)  # => true
expect([1, 3, 2]).to be_reverse_sorted_by(:to_i)  # => false

Duck = Struct.new(:color)
expect([Duck.new('White'), Duck.new('Grey')]).to be_reverse_sorted_by(:color) }  # => success
expect([Duck.new('Grey'), Duck.new('White')]).to be_reverse_sorted_by(:color) }  # => failure

Copyright

Copyright (c) 2014 David DIDIER. See LICENSE.txt for further details.