52 releases (26 breaking)

0.28.0 Nov 4, 2020
0.27.0 Jul 25, 2020
0.26.0 Jun 28, 2020
0.23.3 Feb 21, 2020
0.1.4 Jan 11, 2016

#6 in Testing

Download history 7018/week @ 2020-08-04 7543/week @ 2020-08-11 7000/week @ 2020-08-18 6646/week @ 2020-08-25 6177/week @ 2020-09-01 7791/week @ 2020-09-08 6956/week @ 2020-09-15 8452/week @ 2020-09-22 8006/week @ 2020-09-29 7399/week @ 2020-10-06 8392/week @ 2020-10-13 7230/week @ 2020-10-20 6669/week @ 2020-10-27 7291/week @ 2020-11-03 5887/week @ 2020-11-10 5654/week @ 2020-11-17

31,202 downloads per month
Used in 130 crates (129 directly)

MIT license

76KB
1K SLoC

HTTP mocking for Rust!

Get it on crates.io.

Documentation is 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 and it should be run always on the minimum supported Rust version, in order to ensure backwards compatibility.

Install clippy:

rustup component add clippy-preview

Run the linter on the minimum supported Rust version:

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
~141K SLoC