Provides facilities for creating mock ActiveRecord objects and their associations.

Author

Tony Payne <[email protected]>

Copyright

Lone Star Software Engineering Services, Inc., 2007

Homepage

lonestarsoftware.net

Blog

blog.lonestarsoftware.net

License

MIT

Version

0.1

Dependencies

RubyGems, ActiveSupport (Inflector)

Currently, there is not a whole lot of ActiveRecord functionality supported. I’ve only implemented what I need for the active_resources plugin. Hopefully this will provide a good basis to build on for other needs, as well.

As of 0.1, *the tests pass with 100% code coverage and pass heckling with no mutations remaining*

Example:

include MockActiveRecord::Mixin
mock :Book do |book|
  book.column :id, :integer
  book.column :title, :string, :default => ''
  book.column :publisher_id, :integer
  book.column :foo, :string, :content => false
  book.column :bar_id, :integer, :content => true

  book.has_many :authorships
  book.has_many :authors, :through => :authorships
  book.belongs_to :publisher
  book.has_one :fresnarus
end