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/controller/report_new_open311.t | |
| parent | e22563a5c8fde74a8a6f1de29948eb45487e9597 (diff) | |
Factor out test contact creation to function.
Diffstat (limited to 't/app/controller/report_new_open311.t')
| -rw-r--r-- | t/app/controller/report_new_open311.t | 26 | 
1 files changed, 8 insertions, 18 deletions
| diff --git a/t/app/controller/report_new_open311.t b/t/app/controller/report_new_open311.t index a274d918b..15ccef493 100644 --- a/t/app/controller/report_new_open311.t +++ b/t/app/controller/report_new_open311.t @@ -19,16 +19,8 @@ $body->update({      api_key => 'apikey',  }); -my %contact_params = ( -    confirmed => 1, -    deleted => 0, -    editor => 'Test', -    whenedited => \'current_timestamp', -    note => 'Created for test', -);  # Let's make some contacts to send things to! -my $contact1 = FixMyStreet::App->model('DB::Contact')->find_or_create( { -    %contact_params, +my $contact1 = $mech->create_contact_ok(      body_id => $body->id, # Edinburgh      category => 'Street lighting',      email => '100', @@ -37,15 +29,12 @@ my $contact1 = FixMyStreet::App->model('DB::Contact')->find_or_create( {                     { value => [ { name => ['Gas'], key => ['old'] }, { name => [ 'Yellow' ], key => [ 'modern' ] } ] }                 }                ], -} ); -my $contact2 = FixMyStreet::App->model('DB::Contact')->find_or_create( { -    %contact_params, +); +my $contact2 = $mech->create_contact_ok(      body_id => $body->id, # Edinburgh      category => 'Graffiti Removal',      email => '101', -} ); -ok $contact1, "created test contact 1"; -ok $contact2, "created test contact 2"; +);  # test that the various bit of form get filled in and errors correctly  # generated. @@ -176,7 +165,8 @@ foreach my $test (      };  } -$contact1->delete; -$contact2->delete; -  done_testing(); + +END { +    $mech->delete_body($body); +} | 
