diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-03-13 18:04:55 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-03-13 21:54:29 +0000 |
commit | 76e533bd318cb4208faa1bf5cd0c00bde9e08e6c (patch) | |
tree | 7ada0b46c3e75b4d3977ca27960638c191354cc7 /t/app/sendreport | |
parent | e22563a5c8fde74a8a6f1de29948eb45487e9597 (diff) |
Factor out test contact creation to function.
Diffstat (limited to 't/app/sendreport')
-rw-r--r-- | t/app/sendreport/email.t | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/t/app/sendreport/email.t b/t/app/sendreport/email.t index b2cab42ed..65cd7bfa8 100644 --- a/t/app/sendreport/email.t +++ b/t/app/sendreport/email.t @@ -7,11 +7,12 @@ use Test::More; use FixMyStreet; use FixMyStreet::App; -use FixMyStreet::DB::Result::Contact; use FixMyStreet::SendReport::Email; use FixMyStreet::TestMech; use mySociety::Locale; +ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' ); + my $e = FixMyStreet::SendReport::Email->new(); # area id 1000 @@ -19,14 +20,10 @@ my $params = { id => 1000, name => 'Council of the Thousand' }; my $body = FixMyStreet::App->model('DB::Body')->find_or_create($params); ok $body, "found/created body"; -my $contact = FixMyStreet::App->model('DB::Contact')->find_or_create( +my $contact = $mech->create_contact_ok( email => 'council@example.com', body_id => 1000, category => 'category', - confirmed => 1, - deleted => 0, - editor => 'test suite', - whenedited => DateTime->now, note => '', ); @@ -78,6 +75,8 @@ foreach my $test ( { }; } -$contact->delete; - done_testing(); + +END { + $mech->delete_body($body); +} |