Skip to main content

assert_sent

Function assert_sent 

Source
pub fn assert_sent<M>(predicate: impl Fn(&SentMail) -> bool)
where M: Mailable,
Expand description

Laravel’s Mail::fake()/assertSent() - re-exported directly from larust-mail (not through larust_support::mail, which is the production facade apps see; calling fake() from real app code would silently and permanently stop that process from ever sending real mail again). See larust_mail::fake’s own doc comments for the full design rationale. Panics unless at least one recorded M satisfies predicate.

Computes its result and releases the Mutex guard before asserting - panicking with a lock still held would poison it (std::sync::Mutex poisons on an unwind through a held lock), breaking every later assert_sent/assert_not_sent/send() call in the same process with a confusing PoisonError instead of the real assertion failure.