factory_girl, relaxed
Ruby
Switch branches/tags
Nothing to show
Pull request Compare This branch is 3 commits ahead, 46 commits behind stephencelis:gem.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
Gemfile
README.rdoc
Rakefile
miniskirt.gemspec
miniskirt.rb
miniskirt_test.rb

README.rdoc

Miniskirt

Factory girl, relaxed: www.stephencelis.com/2010/01/11/miniskirt.html

Factory.define :user do |f|
  f.login 'johndoe%d'                               # Sequence.
  f.email '%{login}@example.com'                    # Interpolate.
  f.password f.password_confirmation('foobar')      # Chain.
end

Factory.define :post do |f|
  f.user { Factory :user }                          # Blocks, if you must.
end

Factory.define :post, :as => :important_post do |f| # Aliases using :as
  f.status 'muy importante'
end

Install

% [sudo] gem install miniskirt

In a Rails ~> 3 project:

# Gemfile
gem "miniskirt"

% gem bundle # If necessary, `[sudo] gem install bundler`

# test/test_helper.rb
require "miniskirt"
require "factories" # If you define your factories in test/factories.rb

In a Rails ~> 2.2 project:

# config/environments/test.rb
config.gem "miniskirt"

% [sudo] rake gems:install

# test/test_helper.rb
require "factories" # If you define your factories in test/factories.rb

License

(The MIT License)

© 2010 Stephen Celis, stephen@stephencelis.com.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.