Parent

Shoulda::Matchers::ActiveModel::ExceptionMessageFinder

Finds message information from exceptions thrown by valid?

Public Class Methods

new(instance, attribute, context=nil) click to toggle source
# File lib/shoulda/matchers/active_model/exception_message_finder.rb, line 6
def initialize(instance, attribute, context=nil)
  @instance = instance
  @attribute = attribute
  @context = context
end

Public Instance Methods

allow_description(allowed_values) click to toggle source
# File lib/shoulda/matchers/active_model/exception_message_finder.rb, line 12
def allow_description(allowed_values)
  "doesn't raise when #{@attribute} is set to #{allowed_values}"
end
expected_message_from(attribute_message) click to toggle source
# File lib/shoulda/matchers/active_model/exception_message_finder.rb, line 36
def expected_message_from(attribute_message)
  "#{human_attribute_name} #{attribute_message}"
end
has_messages?() click to toggle source
# File lib/shoulda/matchers/active_model/exception_message_finder.rb, line 24
def has_messages?
  messages.any?
end
messages() click to toggle source
# File lib/shoulda/matchers/active_model/exception_message_finder.rb, line 28
def messages
  @messages ||= validate_and_rescue
end
messages_description() click to toggle source
# File lib/shoulda/matchers/active_model/exception_message_finder.rb, line 16
def messages_description
  if has_messages?
    messages.join
  else
    'no exception'
  end
end
source_description() click to toggle source
# File lib/shoulda/matchers/active_model/exception_message_finder.rb, line 32
def source_description
  'exception'
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.