Skip to content
Allows creation of a whole graph of objects on the fly during testing http://blog.absurd.li/2011/09/28/introducing_floor_manager.html
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
Gemfile
Gemfile.lock
HISTORY.txt
LICENSE
README
Rakefile
floor_manager.gemspec

README

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. 

INSTALLATION

Either by installing from http://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 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

Something went wrong with that request. Please try again.