View Source CredoMox.Checks.UnverifiedMox (CredoMox v0.1.2)

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

This check has a base priority of high and works with any version of Elixir.

Explanation

Ensures that Mox expectations are always verified. Without either setting up :verify_on_exit! or manually calling verify! after your expectations, calls to Mox.expect/4 within your test will never fail, so the test will pass regardless of whether your expected function was called.

Check-Specific Parameters

There are no specific parameters for this check.

General Parameters

Like with all checks, general params can be applied.

Parameters can be configured via the .credo.exs config file.

Summary

Functions

Inspects test files for the use of Mox.expect/4 where the expectations being made are unverified.

Functions

Link to this function

run(source_file, params)

View Source

Inspects test files for the use of Mox.expect/4 where the expectations being made are unverified.

If unverified expectations are found, this check will flag the test file as an issue. The offending file will be displayed in the resulting issue when running mix credo --strict, and the line number indicated in the issue will point to the first use of expect in that file where the expectation has not been verified.