Convert to the new Rspec syntax with Vim macros

ruby vim

Posted

Rspec 2.11 introduces a new syntax: expect(foo).to eq('bar') instead of foo.should eq('bar'). Myron Marston has explained why in detail; essentially it boils down to "passing arbitrary objects to expect is easier than reliably defining a should method on every possible object."

You probably should start using the new syntax, and you might expect it to be a chore. Unix masters could surely use something like awk to do it in bulk, but I haven't taken the time to learn it yet.

For the small chore of converting Authority's tests, a couple of git greps and Vim macros were enough. Here's how I did it: