RSpec new expectation: finally not shoving a verb into a noun
Jun 23, 2012 · 1 minute read · CommentsprogrammingRubyRSpecsemanticssyntax
I recently saw a note describing how Ruby’s RSpec will soon deprecate should
in favor of the “new expectation syntax” expect
.
I sighed. should
was a terrible mistake in the first place.
Calling this a change in syntax is misleading. It’s the semantics that matters, and it’s the obsessive desire to play with syntax in the first place that led to the original should
monkey-patching nightmare.
In the terminology of Steve Yegge’s famous rant about the kingdom of nouns: there was no good reason to shove the verb should
into a class definition (noun).
An expectation of something shouldn’t be monkey-patched into an object.
The expectation is external, not internal, not something to be owned by a class. The new RSpec finally recognizes this.