Mark Hustad
Mark Hustad

Reputation: 169

Quick way to update RSpec 2.9 to 3.3 with sublime text 2

I'm curious if anyone knows a quick way to update the syntax. That is

be_true to be_truthy
mock to double
stub to double

For reasons that would take to long to explain here I can't use the transpec gem. Already tried and it didn't work. I found a bit of hack here

-> expected true to respond to true?

on that worked for most of my tests but I need my tests to reflect the actual changes.

Is command + shift + F search my only option here? I imagine I'm not the only one here who has done something similar. Thanks.

Upvotes: 0

Views: 38

Answers (1)

Philip Hallstrom
Philip Hallstrom

Reputation: 19889

I would suggest doing it in the shell using perl/ruby/etc. Just be sure to run all your tests after each change, commit, and continue in case you mess up the regex. For example, the below should replace your first case. The second two would need some testing to ensure you didn't over do it.

cd spec
perl -i -p -e 's/be_true/be_truthy/g' `git grep -l be_true`

Upvotes: 1

Related Questions