Is Minitest::Assertions#assert Ever the Best Choice?

Burdette Lamar - Apr 5 '19 - - Dev Community

I'm writing something about Minitest::Assertions, which causes me to wonder:

  • Is there an occasion when a simple assert(test) could not be replaced by a more informative assertion?

For example:

  • assert(5 <= 4) reports only Expected false to be truthy.

Whereas:

  • assert_operator(5, :<=, 4) reports Expected 5 to be <= 4.

I have not been able to come up with an example where assert is the best we can do.

Thoughts?

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .