#mocking

mockable

Usefull components to make easier to mock your code

17 releases (10 stable)

3.0.0 Mar 22, 2024
2.5.0 Jan 27, 2024
2.4.0 Dec 6, 2023
2.2.0 Nov 20, 2023
0.1.4 Sep 22, 2023

#149 in Testing

Download history 6/week @ 2024-01-27 217/week @ 2024-02-10 11/week @ 2024-02-17 23/week @ 2024-02-24 3/week @ 2024-03-09 103/week @ 2024-03-16 55/week @ 2024-03-23 57/week @ 2024-03-30 29/week @ 2024-04-06 20/week @ 2024-04-13 43/week @ 2024-04-20

150 downloads per month

Custom license

50KB
726 lines

mockable

This crate provides usefull traits to make easier to mock your code using mockall crate.

Getting Started

Add this to your Cargo.toml:

[dependencies]
mockable = { version = "2", features = [ ... ] }

[dev-dependencies]
mockable = { version = "2", features = ["mock"] }

Documentation

Documentation

Clock

The Clock trait provides a way to mock the current time.

Note: This trait is only available when the clock feature is enabled.

Example.

Command Runner

The CommandRunner trait provides a way to mock the execution of commands.

Note: This trait is only available when the cmd feature is enabled.

Example.

Env

The Env trait provides a way to mock the environment variables.

Example.

HTTP Server

The HttpServer trait provides a way to mock a HTTP server.

Note: This trait is only available when the http feature is enabled.

Example.

Mock

The Mock trait provides a way to mock a function.

Example.

System

The System trait provides a way to mock the system.

Example.

UUID Generator

The UuidGenerator trait provides a way to mock the UUID generator.

Note: This trait is only available when the uuid feature is enabled.

Example.

Dependencies

~0.3–13MB
~115K SLoC