Wednesday, 8 May 2013

regex to update from rspec 1 to rspec 2

Rspec 2 removes assign_to and replace it with assigns, here are the regex I'm using in sublime text 2 for the update:


should assign_to\((.*)\).with\(nil\)
assigns($1).should be_nil

should assign_to\(:(.+)\).with\((.+)\)
assigns(:$1).should == $2

should_not assign_to\(:(.*)\)
assigns(:$1).should be_nil

should assign_to\(:(.*)\)
assigns(:$1).should_not be_nil


Links to some doc here