public
Fork of soveran/spawner
Description: Simple fixtures replacement for Rails
Clone URL: git://github.com/nachof/spawner.git
soveran (author)
Tue Jun 10 21:01:26 -0700 2008
name age message
file MIT-LICENSE Tue Jun 10 21:01:26 -0700 2008 First commit [soveran]
file README Tue Jun 10 21:01:26 -0700 2008 First commit [soveran]
file init.rb Tue Jun 10 21:01:26 -0700 2008 First commit [soveran]
directory lib/ Tue Jun 10 21:01:26 -0700 2008 First commit [soveran]
README
Spawner
=========================

Spawner is a simple fixtures replacement. In the examples
I use Faker to generate random data, but you can use any method.

Usage:

class User < ActiveRecord::Base
  spawner do |user|
    user.name = Faker::Name.name
    user.email = Faker::Internet.email
  end
end

Then, in your test or in any other place:

@user = User.spawn

Or, if you need something special:

@user = User.spawn do |user|
  user.name = "Larralde!"
end

Copyright (c) 2008 Michel Martens for CitrusByte (http://www.citrusbyte.com), released under the MIT license.