RSpec::Matcher

Gem Version Code Climate GPA Code Climate Coverage Gemnasium Status Travis CI Status Inch CI Gitter

Table of Contents

Features

  • Implementes RSpec matcher interface as a module.
  • Registers matcher with RSpec.
  • It is stable in contrast to RSpec::Matchers::BaseMatcher.
  • Well tested and documented.

Requirements

  1. MRI 2.1.0

Setup

For a secure install, type the following (recommended):

gem cert --add <(curl -Ls https://raw.githubusercontent.com/pekhee/rspec-matcher/master/pekhee.pem)
gem install rspec-matcher --trust-policy MediumSecurity

NOTE: A HighSecurity trust policy would be best but MediumSecurity enables signed gem verification while allowing the installation of unsigned dependencies since they are beyond the scope of this gem.

For an insecure install, type the following (not recommended):

gem install rspec-matcher

Add the following to your Gemfile:

gem "rspec-matcher"

Usage

API Reference

class BeNilMatcher
  include RSpec::Matcher
  register_as "be_nil"

  def match
    actual.nil?
  end

  def failure_message
    "expected #{expected} to be nil"
  end
end

expect(nil).to be_nil

Tests

To test, run:

bundle exec rake

Versioning

Read Semantic Versioning for details. Briefly, it means:

  • Patch (x.y.Z) - Incremented for small, backwards compatible bug fixes.
  • Minor (x.Y.z) - Incremented for new, backwards compatible public API enhancements and/or bug fixes.
  • Major (X.y.z) - Incremented for any backwards incompatible public API changes.

Code of Conduct

Please note that this project is released with a CODE OF CONDUCT. By participating in this project you agree to abide by its terms.

Contributions

Read CONTRIBUTING for details.

License

Copyright (c) 2016 Pooyan Khosravi. Read the LICENSE for details.

History

Read the CHANGELOG for details. Built with Gemsmith.

Credits

Developed by Pooyan Khosravi at Pooyan Khosravi.