# `Mob.ScreenCase.StateOwner`
[🔗](https://github.com/genericjam/mob/blob/master/lib/mob/screen_case/state_owner.ex#L1)

Owns the `Mob.State` that concurrently running `Mob.ScreenCase` tests share.

`Mob.State` is one globally named process over a globally named `:dets`
table, so async screen tests cannot each start their own. Checking for it and
starting it from every test raced: two tests saw no process, and the second
start failed with `:already_started`. A store one test started was also
stopped when that test ended, even while another test was still using it.

Every checkout and check-in goes through this process, so they are
serialised. The first checkout starts `Mob.State` against a throwaway
`MOB_DATA_DIR`, overlapping checkouts share it, and the last check-in stops it
and restores the variable. `Mob.ScreenCase` checks in from `on_exit`, which
ExUnit runs before it moves on, so tests that run afterwards (including
`async: false` ones that start `Mob.State` themselves) find it gone. A
`Mob.State` something else already started is shared but never stopped here.
Started on first use and unlinked, so it outlives any single test.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

---

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