reinhardt-testkit 0.2.0-rc.1

Core testing infrastructure for Reinhardt framework (no functional crate dependencies)
reinhardt-testkit-0.2.0-rc.1 has been yanked.
Visit the last successful build: reinhardt-testkit-0.1.1

reinhardt-testkit

Core testing infrastructure for the Reinhardt framework.

DI mock fixtures

reinhardt-testkit exposes three layers for mocking DI dependencies in tests:

  1. with_di_overrides! macro (most ergonomic)
  2. DiOverrideBuilder + injection_context_with_di_overrides (closure form)
  3. injection_context_with_overrides (legacy; scope-seeding only)
use reinhardt_testkit::with_di_overrides;
use rstest::*;
use serial_test::serial;

#[rstest]
#[serial(di_registry)]
#[tokio::test]
async fn example() {
    let (ctx, _di) = with_di_overrides! {
        singleton Config { url: "test".into() },
    };
    // Use `ctx` as your test InjectionContext.
}

See instructions/TESTING_STANDARDS.md (the TI- entry about with_di_overrides!) for the full rule set.