8 ms·
The first 1/3 of the article explains their historical motivation for this approach and specifically why this was a breakthrough for teaching. Names can matter.
by tmp538394722 5y ago
The first 1/3 of the article explains their historical motivation for this approach and specifically why this was a breakthrough for teaching. Names can matter.
And from a more practical standpoint, RSpec is now much more than just a different mapping of some key words.
the DSL rspec landed on can be very concise, which I appreciate. This is mostly made possible by Ruby’s short block syntax and the ability to nest them.
One thing this enables is an easy way to define a hierarchy of concerns with their own nested setup/tear down blocks, which allows you to easily share code across similar example groups.
This is nice in and of itself, but it also leads you to differentiate the “boring setup” code from the “here’s the part I’m actually testing code” which is helpful for clarity when coming back to old tests.
These things are sharp knives and can be used poorly, but I’ve never yet found a system I like better.
- srbaker 5y agoExactly this. My main point, I think, is that once people learned how to _think_ about these problems, they could be shown the "normal" syntax and it would click. This is why I thought it was valuable as a teaching tool, and not valuable beyond that. Others disagreed. I'm just a dude trying to help people, though. What do I know?