Search code examples
rubyunit-testingminitestexpectationsfluent-assertions

Is there a "should" minitest gem?


I would like to use fluent assertions type of syntax with minitest

result.should_be "my result"
result.should_be_true
result.should_contain "foo"

Is there some gem that adds this functionality?

My request come from a similar idea in C#.


Solution

  • Minitest already comes with its own module for this kind of assertions, it is Minitest::Expectations

    result.must_equal 'my result'
    result.must_equal true
    result.must_include 'foo'
    result.wont_include 'bar'