rubocop-rspec icon indicating copy to clipboard operation
rubocop-rspec copied to clipboard

Cop idea: discourage the use of `assert_`/`refute_` Minitest matchers

Open pirj opened this issue 3 years ago • 12 comments

Suggested by @Darhazer

RSpec Expectations allows using assert_/refute_ Minitest matchers However, RSpec comes with its matchers that pretty much cover the same:

- assert_equal a, b
+ expect(a).to eq(b)

A notable difference is that Minitest allows for an optional failure message. It's a lesser known RSpec feature, but it allows it, too:

- assert_equal a, b, "must be equal"
+ expect(a).to(eq(b), "must be equal")

pirj avatar Nov 15 '22 16:11 pirj