Skip to content

Instantly share code, notes, and snippets.

@bhornseth
Forked from Arkham/vimrc
Created August 12, 2016 21:06
Show Gist options
  • Save bhornseth/e3c4f67eb15ec0f46365569c06fceeb0 to your computer and use it in GitHub Desktop.
Save bhornseth/e3c4f67eb15ec0f46365569c06fceeb0 to your computer and use it in GitHub Desktop.
Convert old rspec should syntax to new expect syntax
function! ConvertShouldToExpect()
let rspec_conversions = {
\ 'should': 'to',
\ 'should_not': 'not_to',
\ 'should_receive': 'to receive',
\ 'should_not_receive': 'not_to receive',
\ }
for [old, new] in items(rspec_conversions)
execute "normal! " . ':%s/\v^(\s+)(.+)\.' . old . '>/\1expect(\2).' . new . '/ge' . "\<CR>"
endfor
endfunction
nnoremap <Leader>cse :call ConvertShouldToExpect()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment