Spectus

Build Status Dependency Status Gem Version Inline docs Documentation

Expectation library with RFC 2119's requirement levels, and some matchers for Ruby.

Contact

Rubies

Installation

Add this line to your application's Gemfile:

gem 'spectus'

And then execute:

$ bundle

Or install it yourself as:

$ gem install spectus

Results

Requirement levels MUST SHOULD MAY
Implemented & Matched true true true
Implemented & Not matched false true false
Implemented & Exception false false false
Not implemented false false true

Usage

Absolute requirement definition:

Spectus.this { 'foo'.upcase }.MUST eql: 'FOO' # => true

Absolute prohibition definition:

Spectus.this { 'foo'.length }.MUST_NOT equal: 42 # => true

Recommended definition:

Spectus.this { 'foo'.valid_encoding? }.SHOULD equal: true # => true

Not recommended definition:

Spectus.this { ''.blank? }.SHOULD_NOT raise_exception: NoMethodError # => true

Optional definition:

Spectus.this { 'foo'.bar }.MAY match: /^foo$/ # => true

Versioning

Spectus follows Semantic Versioning 2.0.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request