0

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.

Community
  • 1
  • 1
Mark Hustad
  • 169
  • 1
  • 14

1 Answers1

1

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`
Philip Hallstrom
  • 19,673
  • 2
  • 42
  • 46
  • Thanks. I just got back to work today so I'll see what works. – Mark Hustad Aug 18 '15 at 14:25
  • The above with the help of one of my coworker's lead me to an answer so thanks. Ended up doing `find . -name "*_spec.rb" | xargs sed -i -re "s@be_false($|[^y])@be_falsey@g"` – Mark Hustad Aug 19 '15 at 17:34