46 releases (23 breaking)

✓ Uses Rust 2018 edition

new 0.25.0 Apr 5, 2020
0.23.3 Feb 21, 2020
0.23.0 Jan 30, 2020
0.22.0 Nov 11, 2019
0.1.4 Jan 11, 2016

#4 in Testing

Download history 4908/week @ 2019-12-15 1427/week @ 2019-12-22 2856/week @ 2019-12-29 5360/week @ 2020-01-05 5673/week @ 2020-01-12 6303/week @ 2020-01-19 6979/week @ 2020-01-26 5835/week @ 2020-02-02 6550/week @ 2020-02-09 4911/week @ 2020-02-16 5612/week @ 2020-02-23 4454/week @ 2020-03-01 4825/week @ 2020-03-08 5411/week @ 2020-03-15 5059/week @ 2020-03-22 3900/week @ 2020-03-29

23,457 downloads per month
Used in 83 crates (82 directly)

MIT and maybe MPL-2.0

77KB
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 publish

Benchmarks

Install rust nightly:

rustup install nightly

Run benchmarks:

rustup run nightly cargo bench

Logo courtesy to http://niastudio.net 👌

Dependencies

~2.7–3.5MB
~86K SLoC