aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-12-14 19:07:08 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-12-19 14:43:26 +0000
commitddf9dbdbf6486c781ca4a5822614b0b7cee2c062 (patch)
tree09c12affc3390138b03292d3f90810287b4941d0 /t/cobrand
parentda29e8a75eaa92e98807ad89d29d3d1f3c01bc14 (diff)
Allow bodies to span multiple area IDs, and areas can be covered by more than one body.
Diffstat (limited to 't/cobrand')
-rw-r--r--t/cobrand/get_body_sender.t10
1 files changed, 7 insertions, 3 deletions
diff --git a/t/cobrand/get_body_sender.t b/t/cobrand/get_body_sender.t
index 8475f5eed..245cb1a13 100644
--- a/t/cobrand/get_body_sender.t
+++ b/t/cobrand/get_body_sender.t
@@ -12,23 +12,27 @@ mySociety::Locale::gettext_domain( 'FixMyStreet' );
my $c = FixMyStreet::Cobrand::FixMyStreet->new();
+FixMyStreet::App->model('DB::BodyArea')->search( { body_id => 1000 } )->delete;
FixMyStreet::App->model('DB::Body')->search( { name => 'Body of a Thousand' } )->delete;
my $body = FixMyStreet::App->model('DB::Body')->find_or_create({
- area_id => 1000,
+ id => 1000,
name => 'Body of a Thousand',
});
+my $body_area = $body->body_areas->find_or_create({ area_id => 1000 });
+
is_deeply $c->get_body_sender( $body ), { method => 'Email' }, 'defaults to email';
-$body->area_id( 2481 ); # Croydon LBO
+$body_area->update({ area_id => 2481 }); # Croydon LBO
is_deeply $c->get_body_sender( $body ), { method => 'London' }, 'returns london report it if London borough';
$body->send_method( 'TestMethod' );
is $c->get_body_sender( $body )->{ method }, 'TestMethod', 'uses send_method in preference to London';
-$body->area_id( 1000 ); # Nothing
+$body_area->update({ area_id => 1000 }); # Nothing
is $c->get_body_sender( $body )->{ method }, 'TestMethod', 'uses send_method in preference to Email';
+$body_area->delete;
$body->delete;
done_testing();