Minicrest
Hamcrest-style composable matchers for Minitest. Write expressive, readable assertions with detailed failure messages.
Features
-
Fluent assertion API with
assert_that -
Composable matchers using
&(AND) and|(OR) operators -
Deep equality comparison for arrays and hashes with detailed diffs
-
Reference equality testing
-
Logical combinators:
all_of,none_of,some_of -
Descriptive failure messages that pinpoint exactly what went wrong
-
Extensible: create and register your own custom matchers
Installation
Add to your Gemfile:
gem 'minicrest'
Then run:
bundle install
Usage
Include Minicrest::Assertions in your test class:
require 'minicrest'
class MyTest < Minitest::Test
include Minicrest::Assertions
def test_basic_equality
assert_that(42).equals(42)
end
end
See USAGE.md for more details and a full list of available matchers.
Running Tests
To run the library’s own tests:
rake test
License
AGPL-3.0-only
See LICENSE for details.