Skip to content

Instantly share code, notes, and snippets.

@griffinqiu
Last active March 30, 2018 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save griffinqiu/f21c0b42c55528f7e405dcc0c10ab457 to your computer and use it in GitHub Desktop.
Save griffinqiu/f21c0b42c55528f7e405dcc0c10ab457 to your computer and use it in GitHub Desktop.
Search and replace to add `params` in controller tests when upgrading rails to 5.1 in Vim
/\v^(\s+)(get|post|put|patch|destroy) :(\w+), ([^params].+[^,])$
:%s//\1\2 :\3, params: { \4 }/g
:%s/\v^(\s+)(get|post|put|patch|destroy) :(\w+), ([^params].+[^,])$/\1\2 :\3, params: { \4 }/g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment