Sha256: e7847b1f9ee07467e246e9101cfc16cebb9ac7564a413f9afabe67dc04c550e3

Contents?: true

Size: 1004 Bytes

Versions: 7

Compression:

Stored size: 1004 Bytes

Contents

module Remarkable
  module ActiveRecord
    module Matchers
      class ValidatePresenceOfMatcher < Remarkable::ActiveRecord::Base #:nodoc:
        arguments :collection => :attributes, :as => :attribute
        optional  :message

        collection_assertions :allow_nil?
        default_options :message => :blank, :allow_nil => false
      end

      # Ensures that the model cannot be saved if one of the attributes listed is not present.
      #
      # == Options
      #
      # * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
      #   Regexp, string or symbol. Default = <tt>I18n.translate('activerecord.errors.messages.blank')</tt>
      #
      # == Examples
      #
      #   should_validate_presence_of :name, :phone_number
      #   it { should validate_presence_of(:name, :phone_number) }
      #
      def validate_presence_of(*args)
        ValidatePresenceOfMatcher.new(*args).spec(self)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
remarkable_activerecord-3.0.4 lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb
remarkable_activerecord-3.0.2 lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb
remarkable_activerecord-3.0.3 lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb
remarkable_activerecord-3.0.1 lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb
remarkable_activerecord-3.0.6 lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb
remarkable_activerecord-3.0.5 lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb
remarkable_activerecord-3.0.7 lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb