This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Run the following if you haven't already:
gem sources -a http://gems.github.com
Install the gem(s):
sudo gem install thoughtbot-factory_girl
Joe Ferris (author)
Sat May 31 10:46:33 -0700 2008
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Wed May 28 15:28:02 -0700 2008 | [Joe Ferris] |
| |
README | Wed May 28 22:11:33 -0700 2008 | [Joe Ferris] |
| |
Rakefile | Sat May 31 10:46:33 -0700 2008 | [Joe Ferris] |
| |
lib/ | Fri May 30 17:10:55 -0700 2008 | [Joe Ferris] |
| |
test/ | Wed May 28 19:22:48 -0700 2008 | [Joe Ferris] |
README
= factory_girl
== Defining factories
# This will guess the User class
Factory.define :user do |u|
u.first_name 'John'
u.last_name 'Doe'
u.admin false
end
# This will use the User class (Admin would have been guessed)
Factory.define :admin, :class => User do |u|
u.first_name 'Admin'
u.last_name 'User'
u.admin true
end
It is recommended that you create a test/factories.rb file and define your
factories there. This file can be included from test_helper or directly from
your test files. Don't forget:
require 'factory_girl'
== Using factories
# Build and save a User instance
Factory(:user)
# Build a User instance and override the first_name property
Factory.build(:user, :first_name => 'Joe')
# Return an attributes Hash that can be used to build a User instance
attrs = Factory.attributes_for(:user)




