我想知道我可以在我所有的rspec的文件,這樣的代碼替換:用它替換紅寶石一個襯墊;端塊
describe ApiController do
context 'article list exist' do
#...
it { should respond_with :success }
it { should render_template 'refresh_article_in_article_list' }
end
end
到
describe ApiController do
context 'article list exist' do
#...
it do
should respond_with :success
should render_template 'refresh_article_in_article_list'
end
end
end
我可以用vim宏替換之一,但不是成功多行。
隨着幫助this post我一直試圖做的紅寶石GSUB但我失敗了,我會不斷搜索:
"it { should respond_with :success }\n\nit { should render_template 'refresh_article' }".gsub(/(?<value>{.*})|(it {)|(})/, 'it do \k<value>\nend'))
=> "it do \\nend should respond_with :successit do \\nend\n\nit do \\nend should render_template 'refresh_article'it do \\nend"
你有多少個?也許只是用手改變它們而忘記它? –
@ sergio-tulentsev我可能有超過15000條這樣的一行。 :) – Mio