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 5086/week @ 2020-06-04 5240/week @ 2020-06-11 6048/week @ 2020-06-18 5555/week @ 2020-06-25 5366/week @ 2020-07-02 6891/week @ 2020-07-09 7010/week @ 2020-07-16 8419/week @ 2020-07-23 6487/week @ 2020-07-30 7585/week @ 2020-08-06 6951/week @ 2020-08-13 7306/week @ 2020-08-20 6311/week @ 2020-08-27 6464/week @ 2020-09-03 7252/week @ 2020-09-10 7060/week @ 2020-09-17

29,200 downloads per month
Used in 120 crates (119 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