Module: Reeve::Testing

Defined in:
lib/reeve/testing.rb,
lib/reeve/testing/checks.rb,
lib/reeve/testing/ledger.rb,
lib/reeve/testing/report.rb,
lib/reeve/testing/result.rb,
lib/reeve/testing/matchers.rb,
lib/reeve/testing/assertions.rb,
lib/reeve/testing/checks/base.rb,
lib/reeve/testing/matchers/base.rb,
lib/reeve/testing/checks/rule_present.rb,
lib/reeve/testing/checks/audit_coverage.rb,
lib/reeve/testing/checks/guard_declared.rb,
lib/reeve/testing/compliance_assertions.rb,
lib/reeve/testing/checks/redaction_holds.rb,
lib/reeve/testing/checks/contract_version.rb,
lib/reeve/testing/matchers/deny_access_for.rb,
lib/reeve/testing/checks/principal_required.rb,
lib/reeve/testing/matchers/audit_every_call.rb,
lib/reeve/testing/matchers/pass_reeve_check.rb,
lib/reeve/testing/checks/cross_principal_leak.rb

Overview

The testing kit: framework-neutral checks, and thin front-ends over them.

require "reeve/testing"    # the checks, and nothing else
require "reeve/rspec"      # + matchers and the shared example group
require "reeve/minitest"   # + assertions and the compliance test case

This file loads no test framework and no ActiveRecord, so the checks are runnable from a rake task, a CI script or a boot-time assertion in staging (FR-020, FR-026):

require "reeve/testing"
report = Reeve::Checks.run_all(principals: [alice, bob])
abort report.to_s unless report.passed?

Defined Under Namespace

Modules: Assertions, Checks, ComplianceAssertions, Matchers Classes: Ledger, Report, Result

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.compliance_principalsObject

Raises:



33
34
35
36
37
38
39
40
41
# File 'lib/reeve/testing.rb', line 33

def compliance_principals
  source = @compliance_principals || Reeve.config.compliance_principals
  raise ConfigurationError, missing_principals_message if source.nil?

  principals = Array(source.respond_to?(:call) ? source.call : source)
  raise ConfigurationError, missing_principals_message if principals.size < 2

  principals
end

Class Method Details

.compliance_principals?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/reeve/testing.rb', line 43

def compliance_principals?
  !(@compliance_principals || Reeve.config.compliance_principals).nil?
end

.reset!Object



47
48
49
# File 'lib/reeve/testing.rb', line 47

def reset!
  @compliance_principals = nil
end