Skip to content

Commit

Permalink
Use scoped mock.
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeMathWalker committed Jul 21, 2021
1 parent 5299ef1 commit 9752cfc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
29 changes: 4 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/api/newsletter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use wiremock::{Mock, ResponseTemplate};
async fn create_unconfirmed_subscriber(app: &TestApp) -> ConfirmationLinks {
let body = "name=le%20guin&email=ursula_le_guin%40gmail.com";

Mock::given(path("/email"))
let _mock_guard = Mock::given(path("/email"))
.and(method("POST"))
.respond_with(ResponseTemplate::new(200))
.up_to_n_times(1)
.mount(&app.email_server)
.mount_as_scoped(&app.email_server)
.await;
app.post_subscriptions(body.into())
.await
Expand Down

0 comments on commit 9752cfc

Please sign in to comment.