Skip to content

Credo check for ensuring that Mox expect calls have been verified

License

Notifications You must be signed in to change notification settings

carsdotcom/credo_mox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CredoMox

Credo Checks to ensure correct usage of the Mox library.

Provides a Credo check that ensures tests that have imported Mox and use the Mox.expect/4 function are verifying those expectations. See the CredoMox.Checks.UnverifiedMox module for more details.

Usage

To add the CredoMox.Checks.UnverifiedMox check to your Credo configuration, in your .credo.exs file add the UnverifiedMox module to your checks and configure it to only include test files:

# ... .credo.exs
  checks: [
    ## other Credo checks...
    {CredoMox.Checks.UnverifiedMox, files: %{included: ["**/*_test.exs"]}},
  ]

Installation

The package can be installed by adding credo_mox to your list of dependencies in mix.exs:

def deps do
  [
    {:credo_mox, "~> 0.1", only: [:dev, :test], runtime: false},
  ]
end

Docs can be found at https://hexdocs.pm/credo_mox.