Skip to content

Instantly share code, notes, and snippets.

@dpetersen
Created August 8, 2012 18:05
Show Gist options
  • Save dpetersen/3297119 to your computer and use it in GitHub Desktop.
Save dpetersen/3297119 to your computer and use it in GitHub Desktop.
User spec with implicit subject
describe User do
describe "#can_do_dangerous_stuff?" do
subject { user.can_do_dangerous_stuff? }
context "when the User is a customer" do
let(:user) { User.new("customer") }
it { should be_false }
end
context "when the User is an admin" do
let(:user) { User.new("admin") }
it { should be_true }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment