require 'active_model' require 'rspec' require 'credible_email' class Person include ActiveModel::Validations validates :email, email: true def initialize(attributes = {}) @attributes = attributes end def read_attribute_for_validation(key) @attributes[key] end end