Skip to content

Instantly share code, notes, and snippets.

@benmills
Created February 14, 2012 21:01
Show Gist options
  • Save benmills/1830404 to your computer and use it in GitHub Desktop.
Save benmills/1830404 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'factory_girl'
class Foo
attr_accessor :bar
end
FactoryGirl.define do
factory :foo do
bar [1,2,3]
end
end
a = FactoryGirl.build(:foo)
p a.bar
#[1, 2, 3]
a.bar << 4
b = FactoryGirl.build(:foo)
p b.bar
#[1, 2, 3, 4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment