frodsan/minitest-activemodel

View on GitHub
lib/matchers/validate_presence_matcher.rb

Summary

Maintainability
A
0 mins
Test Coverage
module MiniTest
  module Matchers
    module ActiveModel
      # Ensures that the model is invalid if the given attribute is not present.
      #
      #   it { must validate_presence_of(:name) }
      def validate_presence_of attr
        ValidationMatcher.new attr, :presence
      end
    end
  end
end