InactiveRecord ============== Because objects a lazy too! InactiveRecord is a mocking framework built on top of "Mocha":http://mocha.rubyforge.org/ specifically for mocking ActiveRecord. Mocha version 0.5.3 or greater is required. Installation ------------ Add this line to your test/test_helper.rb file: => require 'inactive_record' require 'test_help' ... If you're using Mocha as a gem, be sure to load it before InactiveRecord in your environment.rb: config.plugins = %W( mocha inactive_record ) Examples -------- Product.finds 1, :name => 'Pizza' Then calling Product.find(1) will return an instance of product with the id 1 and the name Pizza. Product.find(:all) will return all records registered with the +finds+ method. You also get the Product.count for free. You can also use the wildcard magic word +:anything+ to return the same thing whatever the id or the finder used. Product.finds :anything, :name => 'god' Product.find_by_name 'what?' # => <#Product name=god> Product.find(123) # => <#Product name=god> finds_by_* allows you to use the find_by_* methods. Additionnaly the corresponding method will be initialized. Product.finds_by_name 'marc' Product.find_by_name 'marc' # => <#Product name=marc> You can inactivate an ActiveRecord class to use it without relying on a table. Product.inactivate! :name => :string Will almost be like there was a products table with a name column of string type. What? ----- Any questions or comments are welcome! macournoyer@gmail.com