Method: Remarkable::MongoMapper::Matchers#allow_values_for
- Defined in:
- lib/remarkable/mongo_mapper/matchers/allow_values_for_matcher.rb
#allow_values_for(attribute, *args, &block) ⇒ Object
Ensures that the attribute can be set to the given values.
Options
-
:allow_nil- when supplied, validates if it allows nil or not. -
:allow_blank- when supplied, validates if it allows blank or not. -
:message- value the test expects to find inerrors.on(:attribute). Regexp, string or symbol. Default =I18n.translate('activerecord.errors.messages.invalid')
Examples
should_allow_values_for :isbn, "isbn 1 2345 6789 0", "ISBN 1-2345-6789-0"
it { should allow_values_for(:isbn, "isbn 1 2345 6789 0", "ISBN 1-2345-6789-0") }
79 80 81 82 |
# File 'lib/remarkable/mongo_mapper/matchers/allow_values_for_matcher.rb', line 79 def allow_values_for(attribute, *args, &block) = args. AllowValuesForMatcher.new(attribute, .merge!(:in => args), &block).spec(self) end |