Skip to content

Instantly share code, notes, and snippets.

@tanelsuurhans
Created May 15, 2011 22:54
Show Gist options
  • Save tanelsuurhans/973637 to your computer and use it in GitHub Desktop.
Save tanelsuurhans/973637 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe Purchase do
before :all do
@city = Factory.create(:city)
@user = Factory.create(:user, :cities => [@city])
@ticket = Factory.create(:ticket)
end
let!(:city) { @city }
let!(:user) { @user }
let!(:ticket) { @ticket }
subject { Factory.create(:purchase, :user => user, :ticket => ticket, :city => city) }
# some tests here
...
describe "nested context" do
let!(:user) { raise "foo".inspect }
it "should do stuff" do
# subject.user will still be the original old one here :(
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment