module Shoulda::Matchers::ActiveModel
def validate_presence_of(attr)
with_message(/is not optional/) }
it { should validate_presence_of(:name).
it { should validate_presence_of(:name) }
Examples:
Defaults to the translation for :blank.
errors.on(:attribute). Regexp or String.
* with_message - value the test expects to find in
Options:
present.
Ensures that the model is not valid if the given attribute is not
def validate_presence_of(attr) ValidatePresenceOfMatcher.new(attr) end