module Pundit::RSpec::Matchers

def current_example

def current_example
  ::RSpec.current_example
end

def current_example

Compatibility with RSpec < 3.0, released 2014-06-01.
:nocov:
def current_example
  example
end

def description(user, record)

Other tags:
    Private: -

Other tags:
    Api: - private
def description(user, record)
  return @description.call(user, record) if defined?(@description) && @description.respond_to?(:call)
  @description
end

def permissions

def permissions
  current_example.metadata.fetch(:permissions) do
    raise KeyError, <<~ERROR.strip
      No permissions in example metadata, did you forget to wrap with `permissions :show?, ...`?
    ERROR
  end
end

def was_or_were

def was_or_were
  if @violating_permissions.count > 1
    "were"
  else
    "was"
  end
end