Skip to content

Instantly share code, notes, and snippets.

@mhorbul
Created March 27, 2009 22:48
Show Gist options
  • Save mhorbul/86952 to your computer and use it in GitHub Desktop.
Save mhorbul/86952 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Upgrade to rspec-rails 2.2.2
# response.headers["Status"].should == "201 Created" does not work any more
# response.status.should == "201 Created" does work now
#
# find all controllers specs which contains response.headers["Status"].should
# sort them
# and remove duplications
for c in `grep 'Status' -r spec/controllers | grep 'response.headers' | cut -d':' -f1 | sort | uniq`
do
# replace all old fashioned lines with the new fashioned ones
sed -i.orig -e 's/response\.headers\["Status"\]\.should/response.status.should/' $c
done
# remove the original copies of the controller specs
find spec/controllers -name '*.orig' -exec rm -rf {] \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment