Last Updated: February 25, 2016
·
516
· Alexandr K

Replace :key => with key: using vim

%s/\:\(\w\+\)\(\s\+\)=>\s\+/\1:\2/g

Example:

post :create, :app => { :name => "mario", :nested_attributes => { :value => "value1" } }

Result:

post :create, app: { name: "mario", nested_attributes: { value: "value1" } }