43 releases (22 breaking)

✓ Uses Rust 2018 edition

0.23.1 Feb 5, 2020
0.22.0 Nov 11, 2019
0.20.0 Jul 29, 2019
0.17.0 Mar 25, 2019
0.1.4 Jan 11, 2016

#3 in Testing

Download history 3713/week @ 2019-11-01 3699/week @ 2019-11-08 4497/week @ 2019-11-15 3375/week @ 2019-11-22 4170/week @ 2019-11-29 5046/week @ 2019-12-06 4963/week @ 2019-12-13 2160/week @ 2019-12-20 2177/week @ 2019-12-27 5361/week @ 2020-01-03 5786/week @ 2020-01-10 5659/week @ 2020-01-17 6787/week @ 2020-01-24 5909/week @ 2020-01-31 6779/week @ 2020-02-07

19,301 downloads per month
Used in 76 crates (75 directly)

MIT and maybe MPL-2.0

75KB
1.5K 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.35.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.35.0 cargo clippy --lib --tests --all-features -- -D clippy::pedantic -D clippy::nursery

Release

Release:

cargo package && cargo publish

Benchmarks

Install rust nightly:

rustup install nightly

Run benchmarks:

rustup run nightly cargo bench

Logo courtesy to http://niastudio.net 👌

Dependencies

~3MB
~67K SLoC