module FakeActiveRecord def save raise NotImplementedError end def save! raise NotImplementedError end def update_attribute(att, val) self.send("#{att}=", val) end def new_record? true end def initialize(argh = {}) @errors = ActiveRecord::Errors.new(self) argh.each do |key, value| self.send("#{key}=", value) end end module ClassMethods def human_attribute_name(att) att.to_s.humanize end end def self.included(mod) mod.__send__(:include, ActiveRecord::Validations) mod.__send__(:extend, ClassMethods) mod.__send__(:attr_reader, :errors) end end