Class: Reeve::Testing::Checks::PrincipalRequired

Inherits:
Base
  • Object
show all
Defined in:
lib/reeve/testing/checks/principal_required.rb

Overview

FR-001: with no resolvable principal, the call is denied before any policy is consulted.

The evidence is the rule. no_principal is only reachable on the path that denies ahead of authorization; a denial carrying any other rule means the policy was asked a question about nobody, and got an answer.

Reeve::Checks::PrincipalRequired.new(tool: InvoiceSearchTool).call

Instance Method Summary collapse

Methods inherited from Base

check_name, #check_name, #initialize

Constructor Details

This class inherits a constructor from Reeve::Testing::Checks::Base

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
# File 'lib/reeve/testing/checks/principal_required.rb', line 15

def call
  made = attempt(principal: nil)
  return held(made) if made.denial&.rule == Decision::NO_PRINCIPAL
  return wrong_rule(made) if made.denied?
  return raised(made) if made.failed?

  allowed(made)
end