Skip to content

Instantly share code, notes, and snippets.

@sri
Last active December 25, 2015 23:09
Show Gist options
  • Save sri/7055372 to your computer and use it in GitHub Desktop.
Save sri/7055372 to your computer and use it in GitHub Desktop.
# From http://betterspecs.org/:
# For instance methods, use: "#instance_method?"
describe ".class_method" do
# Start context description using "when" or "with".
# Keep it under 40 characters; if longer
# break it up using "context". When run, it should
# output in a readable format.
context "when logged in" do
# Use new rspec syntax. Don't use
# should! Also, each spec should make
# only one assertion (unless it doing
# something heavier).
it { expect(response).to respond_with 200 }
end
end
# Other tips:
# - test all the edge cases.
# - don't use: it "should ..." description
# in your specs
# - use let, let! instead of create instance vars
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment