# `Bandera.Test`

Test helpers for toggling Bandera flags with per-test, async-safe isolation.

Backed by `Bandera.Store.ProcessScoped` (NimbleOwnership). Setup:

    # config/test.exs
    config :bandera, store: Bandera.Store.ProcessScoped

    # test/test_helper.exs
    Bandera.Test.start()

    # a test module
    defmodule MyTest do
      use ExUnit.Case, async: true
      use Bandera.Test

      @tag feature_flags: [my_flag: true]
      test "feature on" do
        assert Bandera.enabled?(:my_flag)
      end

      test "toggle in the body" do
        enable_flag(:other)
        assert Bandera.enabled?(:other)
      end
    end

Overrides are scoped to the test process (and its `$callers`), so tests run
`async: true` without bleeding into each other, and `enable_flag`/`disable_flag`
never touch a database or fire notifications. Cleanup is automatic when the test
process exits (NimbleOwnership monitors owners); `reset/0` clears overrides
explicitly within a test if needed.

The `use Bandera.Test` macro imports `enable_flag/1,2` and `disable_flag/1,2`
for unqualified use. The remaining helpers — `put_flag/2,3`, `clear/1`, and
`reset/0` — are called fully qualified, e.g. `Bandera.Test.reset()`.

Consumers must add `{:nimble_ownership, "~> 1.0", only: :test}` to their deps.

# `clear`

```elixir
@spec clear(atom()) :: :ok
```

Clear a single flag's overrides for the current process.

# `disable_flag`

```elixir
@spec disable_flag(atom()) :: :ok
```

Disable a flag for the current process.

# `disable_flag`

```elixir
@spec disable_flag(atom(), term()) :: :ok
```

Disable a flag for a specific actor in the current process.

# `enable_flag`

```elixir
@spec enable_flag(atom()) :: :ok
```

Enable a flag for the current process.

# `enable_flag`

```elixir
@spec enable_flag(atom(), term()) :: :ok
```

Enable a flag for a specific actor in the current process.

# `put_flag`

```elixir
@spec put_flag(atom(), boolean()) :: :ok
```

Set a flag's boolean value for the current process (and its `$callers`).

# `put_flag`

```elixir
@spec put_flag(atom(), boolean(), term()) :: :ok
```

Set a flag's boolean value for a specific actor in the current process.

# `reset`

```elixir
@spec reset() :: :ok
```

Clear ALL of the current process's flag overrides.

# `start`

```elixir
@spec start() :: :ok
```

Start the NimbleOwnership server backing the process-scoped store.

Idempotent — call once in `test/test_helper.exs`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
