Created
May 10, 2012 08:33
-
-
Save srushti/2651900 to your computer and use it in GitHub Desktop.
Vim commands to convert a Test::Unit/Shoulda to RSpec
This file contains 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
%s/def test_\(.*\)/it "\1" do | |
%s/ should / it / | |
%s/setup do/before(:each) do/ | |
%s/def setup/before(:each) do/ | |
%s/assert_true \(.*\)/\1.should be_true/ | |
%s/assert \(.*\)/\1.should be_true/ | |
%s/assert_false \(.*\)/\1.should be_false/ | |
%s/assert_equal(\(.*\),\(.*\))/\2.should == \1/ | |
%s/assert_equal \(.*\),\(.*\)/\2.should == \1/ | |
%s/assert_nil \(.*\)/\1.should be_nil/ | |
%s/assert_nothing_raised(\(.*\))\(.*\)/lambda \2.should_not raise_error(\1) | |
%s/assert_raise(\(.*\))\({.*}\)/lambda \2.should raise_error(\1) | |
%s/assert_raise(\(.*\)) \({.*}\)/lambda \2.should raise_error(\1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment