Sha256: a8bb938511034b2d261c0b65bafc60494683d9376442f384bb7bfd7a4f683cc5

Contents?: true

Size: 656 Bytes

Versions: 2

Compression:

Stored size: 656 Bytes

Contents

module MiniTest
  module Matchers
    module ActiveModel
      # Ensures that the model is invalid if the given
      # association name is not valid itself.
      #
      #   it { must validate_associated(:parent)   }
      #   it { must validate_associated(:children) }
      def validate_associated association_name
        ValidateAssociated.new association_name
      end

      private

      class ValidateAssociated < ValidationMatcher
        def initialize association_name
          super association_name, :associated
        end

        def description
          "validate associated #{@attr.inspect}"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
minitest-activemodel-1.1.0 lib/matchers/validate_associated_matcher.rb
minitest-activemodel-1.0.0 lib/matchers/validate_associated_matcher.rb