kschiess/floor_manager
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
FLOOR MANAGER - when your job is handling the girls
The floor manager manages a whole graph of objects and lets you create them
in memory or the database for the duration of a test.
You need two posts that are linked up to the same author? [1] Easy:
FloorManager.define :first do
one :author do
name 'John Smith'
end
any :post do
title 'The posts title'
author.set :author
end
end
And in your tests:
before(:each) do
FloorManager.reset
floor = FloorManager.get(:floor)
posts = [floor.create(:post), floor.create(:post)]
end
This gives you two posts to test against. Both posts will have the same
author, right down to the database id.
Look here for more documentation:
http://blog.absurd.li/2011/09/28/introducing_floor_manager.html
INSTALLATION
Either by installing from https://github.com/kschiess/floor_manager as a rails
plugin or by using rubygems:
gem install floor_manager
Then just require it atop of your floor definitions as follows:
require 'floor_manager'
# Your floors go here...
COMPATIBILITY
Has been tested with Ruby 1.9.2/1.8.7 MRI and ActiveRecord/DataMapper.
STATUS
Useful in daily life.
AUTHOR
Kaspar Schiess (kaspar.schiess@absurd.li)
[1] http://robots.thoughtbot.com/post/159807023/waiting-for-a-factory-girl