Skip to content

Instantly share code, notes, and snippets.

@nordringrayhide
Created March 8, 2011 19:05
Show Gist options
  • Save nordringrayhide/860799 to your computer and use it in GitHub Desktop.
Save nordringrayhide/860799 to your computer and use it in GitHub Desktop.
Some Ruby on Rails 3.x, RSpec, Shoulda snippets
# Rails 3.x
snippet vale
validate ${1:method_name}
snippet vals
validates ${1:column}
snippet valsp
validates ${1:column}, :presence => ${$1:true}
# RSpec 2.x
snippet desc
desribe "${1:subject}" do
${2}
end
snippet be
before(:each) { ${1} }
snippet ae
after(:each) { ${1} }
snippet it
it { ${1} }
snippet spec
specify { ${1} }
# Shoulda
snippet sd
should ${1}
snippet svpo
should validate_presence_of ${1:column}
snippet srws
should repond_with :success
snippet srer
should respond_with :redirect
snippet srt
should render_template :${1:name}
snippet srto
should redirect_to ${1:path}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment