module Shoulda::ActiveRecord::Macros

def should_validate_numericality_of(*attributes)


should_validate_numericality_of :age
Example:

Regexp or string. Default = I18n.translate('activerecord.errors.messages.not_a_number')
* :message - value the test expects to find in errors.on(:attribute).
Options:

create a new instance to test against.
model being tested, then this method will use that. Otherwise, it will
If an instance variable has been created in the setup named after the

Ensure that the attribute is numeric
def should_validate_numericality_of(*attributes)
  message = get_options!(attributes, :message)
  klass = model_class
  attributes.each do |attribute|
    matcher = validate_numericality_of(attribute).
      with_message(message)
    should matcher.description do
      assert_accepts matcher, get_instance_of(klass)
    end
  end
end