diff options
| author | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2019-11-14 19:22:38 +0100 |
|---|---|---|
| committer | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2019-11-14 19:22:38 +0100 |
| commit | cc6896cca0839f5d97c5daee8ffba824c3c0d229 (patch) | |
| tree | 991e348c590f3da671a1acc9ebd4f57cd497f974 /tests/fixtures.rs | |
| parent | 1e060f14736922bfbd065a2ac611c64b9e2f5104 (diff) | |
| download | mail-cc6896cca0839f5d97c5daee8ffba824c3c0d229.tar.gz | |
add more tests
Diffstat (limited to 'tests/fixtures.rs')
| -rw-r--r-- | tests/fixtures.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/tests/fixtures.rs b/tests/fixtures.rs index 8887da8..c9e04c8 100644 --- a/tests/fixtures.rs +++ b/tests/fixtures.rs @@ -114,22 +114,16 @@ impl MailBox { -> Result<(String, PathBuf)> { - let mut builder = EmailBuilder::new(); + let mut builder = EmailBuilder::new() + .subject(subject.unwrap_or_else(|| "Test mail".to_string())); + - if let Some(val) = subject { - builder = builder.subject(val); - } if let Some(val) = body { builder = builder.text(val); } - builder = match to { - Some(val) => builder.to(val), - None => builder.to(format!("to@{}.localhost", self.hostname())) - }; - builder = match from { - Some(val) => builder.from(val), - None => builder.from(format!("from@{}.localhost", self.hostname())) - }; + + builder = builder.to(to.unwrap_or_else(|| "to@example.com".to_string())) + .from(from.unwrap_or_else(|| "src@example.com".to_string())); for h in headers.into_iter(){ let hdr: Header = h.into(); |
