Class: AtlasRb::Reset

Inherits:
Object
  • Object
show all
Extended by:
FaradayHelper
Defined in:
lib/atlas_rb.rb

Overview

Test-environment helper that wipes Atlas state via GET /reset.

Do not call against production. This exists so RSpec suites running against a disposable Atlas instance can return to a clean baseline between examples.

Constant Summary

Constants included from FaradayHelper

FaradayHelper::ASSERTION_AUDIENCE, FaradayHelper::ASSERTION_ISSUER, FaradayHelper::ASSERTION_TTL

Class Method Summary collapse

Methods included from FaradayHelper

connection, multipart, system_connection

Class Method Details

.clean(nuid: nil, on_behalf_of: nil) ⇒ String?

Reset the connected Atlas instance to a clean state.

Atlas serves GET /reset with require_auth skipped (it is env-gated, not principal-gated), so this call uses optional auth: it signs an assertion when a credential is available, and sends no Authorization header otherwise — never raising ConfigurationError for lack of one. That lets a test before(:suite) reset before any acting nuid is set.

Examples:

AtlasRb::Reset.clean

Parameters:

  • nuid (String, nil) (defaults to: nil)

    optional acting user's NUID. When a signing key is configured it is signed into the assertion sub; otherwise it is unused (Atlas ignores it on this endpoint). Mostly here for symmetry.

  • on_behalf_of (String, nil) (defaults to: nil)

    optional NUID. Falls through to AtlasRb.config.default_on_behalf_of when omitted.

Returns:

  • (String, nil)

    the raw response body from GET /reset.



141
142
143
# File 'lib/atlas_rb.rb', line 141

def self.clean(nuid: nil, on_behalf_of: nil)
  connection({}, nuid, on_behalf_of: on_behalf_of, auth: :optional).get("/reset")&.body
end