class Shoulda::Matchers::ActiveModel::ExceptionMessageFinder
Finds message information from exceptions thrown by #valid?
def allow_description(allowed_values)
def allow_description(allowed_values) "doesn't raise when #{@attribute} is set to #{allowed_values}" end
def expected_message_from(attribute_message)
def expected_message_from(attribute_message) "#{human_attribute_name} #{attribute_message}" end
def has_messages?
def has_messages? messages.any? end
def human_attribute_name
def human_attribute_name @instance.class.human_attribute_name(@attribute) end
def initialize(instance, attribute)
def initialize(instance, attribute) @instance = instance @attribute = attribute end
def messages
def messages @messages ||= validate_and_rescue end
def messages_description
def messages_description if has_messages? messages.join else 'no exception' end end
def source_description
def source_description 'exception' end
def validate_and_rescue
def validate_and_rescue @instance.valid? [] rescue ::ActiveModel::StrictValidationFailed => exception [exception.message] end