I totally agree about the matrix of scenarios. I'm still not satisfied with contexts in Rspec because of the nested nature. This is somewhat mitigated by shared examples, but still.
Full stack web dev.
Studying FP web development approaches, while helping Mission Bit create paths to programming for underserved public school kids.
Previously @ Gradescope.
FWIW, there are shared contexts too, as you probably know. I'd sometimes make a regular loop outside of the context in order to repeat tests over some values. And helper functions are often handy, and multiline lets.
Beyond that, IME you just get to a point where they're dry enough and let it go. Since they're tests, they're not likely to need much maintenance, and what they do is often repetitive by nature.
Overall, I like the RSpec DSL... my main gripe was that there are two versions of it, so it's possible for a codebase to have a mix of styles. Probably not an issue for projects started after version 3 came out, though.
I haven't used minitest much, but I will say that I'm not a huge fan of structuring tests as classes (a la their "unit test" style, or Python's built-in unittest, or the various xUnit frameworks).
Running tests by line number is a nice feature of RSpec's but I've tended to use the substring filter more anyway, and it looks like minitest has one. (Often the line number changes as you make changes to the file.) Had I not been running my Ruby app inside a VM, I'd probably have made more use of editor integration there anyway.
Also it's hard to overstate the importance of faster test runs :p
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here are some of my opinions about both frameworks.
Rspec
Pros
Cons
Minitest
Pros
Cons
I totally agree about the matrix of scenarios. I'm still not satisfied with contexts in Rspec because of the nested nature. This is somewhat mitigated by shared examples, but still.
Excellent comparison list!
FWIW, there are shared contexts too, as you probably know. I'd sometimes make a regular loop outside of the context in order to repeat tests over some values. And helper functions are often handy, and multiline
let
s.Beyond that, IME you just get to a point where they're dry enough and let it go. Since they're tests, they're not likely to need much maintenance, and what they do is often repetitive by nature.
Overall, I like the RSpec DSL... my main gripe was that there are two versions of it, so it's possible for a codebase to have a mix of styles. Probably not an issue for projects started after version 3 came out, though.
I haven't used minitest much, but I will say that I'm not a huge fan of structuring tests as classes (a la their "unit test" style, or Python's built-in
unittest
, or the various xUnit frameworks).Running tests by line number is a nice feature of RSpec's but I've tended to use the substring filter more anyway, and it looks like minitest has one. (Often the line number changes as you make changes to the file.) Had I not been running my Ruby app inside a VM, I'd probably have made more use of editor integration there anyway.
Also it's hard to overstate the importance of faster test runs :p