vim regexp for replacing mocha 'stubs().returns' style with rspec 'allow().to receive()'
Replace Pattern:
%s/\(\S\+\).stubs(\(:\S\+\)).returns(\(\S\+\))/allow(\1).to receive(\2).and_return(\3)/gc
Before:
controller.stubs(:current_account).returns(@account)
After:
allow(controller).to receive(:current_account).and_return(@account)
Written by Juliano Alves
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#