20 lines
518 B
Rust
20 lines
518 B
Rust
use std::sync::Arc;
|
|
|
|
use async_trait::async_trait;
|
|
use mockall::{mock, predicate::*};
|
|
|
|
use crate::email;
|
|
|
|
mock! {
|
|
pub EmailService {}
|
|
#[async_trait]
|
|
impl email::EmailServiceTrait for EmailService {
|
|
async fn send_email(&self, email: &str, title: &str, message: &str)
|
|
-> Result<(), email::Error>;
|
|
}
|
|
}
|
|
|
|
// Default email service: will crash if `send_email` method is called.
|
|
pub fn new_mock_email_service() -> Arc<dyn email::EmailServiceTrait> {
|
|
Arc::new(MockEmailService::new())
|
|
}
|