Skip to content

Instantly share code, notes, and snippets.

@stevenheidel
Last active December 18, 2015 00:59
Show Gist options
  • Save stevenheidel/5700638 to your computer and use it in GitHub Desktop.
Save stevenheidel/5700638 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe 'foo' do
let(:concert) { FactoryGirl.create :concert } # Creates a concert with name 'default'
before do
Foo.bar(concert.id)
end
describe '.bar' do
it 'should be baz' do
concert.name.should == 'baz' # Fails
puts concert.name #=> 'default'
end
end
end
# elsewhere...
class Foo
def self.bar(concert_id)
concert = Concert.find_by_id(concert_id)
concert.name = 'baz'
concert.save
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment