51 releases (25 breaking)

0.27.0 Jul 25, 2020
0.25.3 Jun 28, 2020
0.23.3 Feb 21, 2020
0.22.0 Nov 11, 2019
0.1.4 Jan 11, 2016

#10 in Testing

Download history 5529/week @ 2020-06-01 4470/week @ 2020-06-08 5643/week @ 2020-06-15 6126/week @ 2020-06-22 5462/week @ 2020-06-29 6343/week @ 2020-07-06 6774/week @ 2020-07-13 7908/week @ 2020-07-20 7144/week @ 2020-07-27 6970/week @ 2020-08-03 7436/week @ 2020-08-10 7031/week @ 2020-08-17 6934/week @ 2020-08-24 6281/week @ 2020-08-31 7246/week @ 2020-09-07 6874/week @ 2020-09-14

24,617 downloads per month
Used in 118 crates (117 directly)

MIT license

72KB
1K SLoC

HTTP mocking for Rust!

Get it on crates.io.

Documentation available at https://docs.rs/mockito.

Before upgrading, make sure to check out the changelog.

Contribution Guidelines

  1. Check the existing issues and pull requests.
  2. One commit is one feature - consider squashing.
  3. Format code with cargo fmt.
  4. :shipit:

Development

Tests

Run tests:

cargo test

...or run tests using a different toolchain:

rustup run --install 1.36.0 cargo test

...or run tests while disabling the default features (e.g. the colors):

cargo test --no-default-features

Code style

Mockito uses rustfmt as a general code style.

Install rustfmt:

rustup component add rustfmt

Format code:

cargo fmt

Some editors might provide a plugin to format your Rust code automatically.

Linter

Mockito uses clippy as a linter.

Install clippy:

rustup component add clippy-preview

Run the linter:

# Touch a file to force cargo to rerun clippy on the project
touch src/lib.rs

cargo clippy --lib --tests --all-features -- -D clippy::pedantic -D clippy::nursery

...or run the linter using a different toolchain:

rustup run --install 1.36.0 cargo clippy --lib --tests --all-features -- -D clippy::pedantic -D clippy::nursery

Release

Release:

cargo publish

Benchmarks

Install rust nightly:

rustup install nightly

Run benchmarks:

rustup run nightly cargo bench

Logo courtesy to http://niastudio.net 👌

Dependencies

~4–5.5MB
~135K SLoC