Sha256: 00b4ec75668b7900ed6ebc8d8a2a87be087c3e7680ce6bc6272cc911a1f01bba

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

# NDD RSpec

[![Build Status](https://secure.travis-ci.org/ddidier/ndd-rspec.png)](http://travis-ci.org/ddidier/ndd-rspec)
[![Dependency Status](https://gemnasium.com/ddidier/ndd-rspec.png)](https://gemnasium.com/ddidier/ndd-rspec)
[![Code Climate](https://codeclimate.com/github/ddidier/ndd-rspec/badges/gpa.svg)](https://codeclimate.com/github/ddidier/ndd-rspec)
[![Test Coverage](https://codeclimate.com/github/ddidier/ndd-rspec/badges/coverage.svg)](https://codeclimate.com/github/ddidier/ndd-rspec)

RSpec utilities.

## 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

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

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

### be\_reverse\_sorted\_by

```ruby
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) } # => true
expect([Duck.new('Grey'), Duck.new('White')]).to be_reverse_sorted_by(:color) } # => false
```

## Copyright

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ndd-rspec-1.1.0 README.md
ndd-rspec-1.0.0 README.md