Question

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#.

Était-ce utile?

La 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'

Autres conseils

rspec adds this assertion type, you can check out the gem here: https://github.com/rspec/rspec-rails

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top