vim regexp for replacing rspec 'should' style with 'expect().to' for eq example.
Replace Pattern:
%s/\(\S\+\).should\(\s\+\)==\s*\(.\+\)/expect(\1).to\2eq(\3)/
Before:
row.day.should == 'value'
After:
expect(row.day).to eq('value')
Written by Alexandr Korsak
Related protips
3 Responses

I'm not quite sure why the expect syntax is that much better.
row.day.should eq 'value' seems much more readable. I would love to hear from you why you use 'expect'.
over 1 year ago
·

As for me it's more readable like a sentence. I think it depends on a developer anyway.
over 1 year ago
·

I think the point is to eliminate 'should'. One less syntax sugar
over 1 year ago
·
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#