Skip to content

Instantly share code, notes, and snippets.

@jeremywrowe
Created August 20, 2013 22:09
Show Gist options
  • Save jeremywrowe/6287993 to your computer and use it in GitHub Desktop.
Save jeremywrowe/6287993 to your computer and use it in GitHub Desktop.
describe Wombat do
let(:active_user) do
user = User.new
user.tap(&:make_active)
end
context "with an active user" do
it "is a cuddly creator" do
expect(Wombat.new(active_user)).to be_cuddly
end
end
context "with an active overriden user" do
let(:active_user) do
# we do something here to override the global active user
# and since it isn't 'fetched' until you call upon it
# this one will be used instead of the one in the outer
# block.
end
it "is a cuddly creator" do
# until active_user is hit in the next line it is not created
expect(Wombat.new(active_user)).to be_cuddly
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment