Matchi::Fix

Version Yard documentation License

Matchi-compatible matcher for testing implementations against Fix specifications.

Installation

Add this line to your application's Gemfile:

gem "matchi-fix"

And then execute:

bundle install

Or install it yourself:

gem install matchi-fix

Description

A Matchi-compatible matcher that allows testing objects against Fix specifications. Enables verification of implementation conformance to Fix test specifications across different testing frameworks like Minitest and RSpec. Integrates seamlessly with the Fix testing framework's powerful specification system while maintaining Matchi's clean matcher interface.

Usage

To make Matchi::Fix available:

require "matchi/fix"

The Fix matcher allows testing values against Fix specifications. After requiring matchi-fix, you can use the Fix matcher in your tests through anonymous specification:

Matchi::Fix.new { it MUST be 42 }.match? { 42 } # => true

or through registered specification by name:

# First, define a Fix specification
Fix :Calculator do
  on(:add, 2, 3) do
    it MUST eq 5
  end

  on(:multiply, 2, 3) do
    it MUST eq 6
  end
end

# Then use the matcher to test implementations
calculator = MyCalculator.new

# Using direct matcher syntax
Matchi::Fix.new(:Calculator).matches?(calculator) #=> true/false

Error Handling

On missing specifications:

Matchi::Fix.new(:NonExistent)
# => KeyError

On passing both specification name and specification code:

Matchi::Fix.new(:SpecName) { "Spec block" }
# => ArgumentError

Contact

Versioning

Matchi::Fix follows Semantic Versioning 2.0.

License

The gem is available as open source under the terms of the MIT License.

Sponsors

This project is sponsored by Sashité