Sha256: e732b6c9227f02490b4f90690abfdd2e6596e14152e1cf2012f8617106777f40

Contents?: true

Size: 658 Bytes

Versions: 7

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

require_relative 'utils/policy_info'

module Pundit
  module Matchers
    # This is the base class for all matchers in the Pundit Matchers library.
    class BaseMatcher
      # Error message when an ambiguous negated matcher is used.
      AMBIGUOUS_NEGATED_MATCHER_ERROR = <<~MSG
        `expect().not_to %<name>s` is not supported since it creates ambiguity.
      MSG

      private

      attr_reader :policy_info

      def setup_policy_info!(policy)
        @policy_info = Pundit::Matchers::Utils::PolicyInfo.new(policy)
      end

      def user_message
        " for '#{policy_info.user}'"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pundit-matchers-3.1.0 lib/pundit/matchers/base_matcher.rb
pundit-matchers-3.0.1 lib/pundit/matchers/base_matcher.rb
pundit-matchers-3.0.0 lib/pundit/matchers/base_matcher.rb
pundit-matchers-3.0.0.beta4 lib/pundit/matchers/base_matcher.rb
pundit-matchers-3.0.0.beta3 lib/pundit/matchers/base_matcher.rb
pundit-matchers-3.0.0.beta2 lib/pundit/matchers/base_matcher.rb
pundit-matchers-3.0.0.beta1 lib/pundit/matchers/base_matcher.rb