Created
November 4, 2010 17:46
-
-
Save gaffneyc/662848 to your computer and use it in GitHub Desktop.
Vim script for converting from test-spec to rspec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:2,3s/context "\(.*\)".*/describe \1 do/ | |
:2,3s/context '\(.*\)'.*/describe \1 do/ | |
:%s/\.be\.nil/ be_nil/g | |
:%s/\.be nil/ be_nil/g | |
:%s/\.be true/ be_true/g | |
:%s/\.be(true)/ be_true/g | |
:%s/\.equal(true)/ be_true/g | |
:%s/\.be false/ be_false/g | |
:%s/\.be(false)/ be_false/g | |
:%s/\.equal(false)/ be_false/g | |
:%s/\.equal(\(.*\))/ == \1/g | |
:%s/\.equal/ ==/ | |
:%s/test_helper/spec_helper/ | |
:%s/specify/it/ | |
:%s/, ActiveSupport::TestCase//g | |
:%s/setup do/before(:each) do/ | |
:%s/\.be\./ be_/ | |
:%s/\.be / ==/ | |
:%s/\.be(\(.*\))/ == \1/g | |
:%s/should\.not/should_not/g | |
:%s/should\.include \(.*\)/should include(\1)/g | |
:%s/should_not\.include \(.*\)/should_not include(\1)/g | |
:%s/should\.respond_to \(.*\)/should respond_to(\1)/g | |
:%s/should_not\.respond_to \(.*\)/should_not respond_to(\1)/g | |
:%s/\(be_.*\)?/\1/g | |
:w |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment