diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixMyStreet.pm | 10 | ||||
-rw-r--r-- | t/cobrand/westminster.t | 30 |
2 files changed, 26 insertions, 14 deletions
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index 015da5e0b..e5327b084 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -200,4 +200,14 @@ sub updates_disallowed { return $self->next::method(@_); } +sub suppress_reporter_alerts { + my $self = shift; + my $c = $self->{c}; + my $problem = $c->stash->{report}; + if ($problem->to_body_named('Westminster')) { + return 1; + } + return 0; +} + 1; diff --git a/t/cobrand/westminster.t b/t/cobrand/westminster.t index 1ceeef6cb..cadd6b18d 100644 --- a/t/cobrand/westminster.t +++ b/t/cobrand/westminster.t @@ -162,21 +162,23 @@ FixMyStreet::override_config { }; }; -FixMyStreet::override_config { - ALLOWED_COBRANDS => 'westminster', - MAPIT_URL => 'http://mapit.uk/', -}, sub { - subtest 'No reporter alert created' => sub { - my $user = $mech->log_in_ok('test@example.org'); - $mech->get_ok('/'); - $mech->submit_form_ok( { with_fields => { pc => 'SW1A1AA' } }, "submit location" ); - $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" ); - $mech->submit_form_ok( { with_fields => { - title => 'Title', detail => 'Detail', category => 'Abandoned bike', name => 'Test Example', - } }, 'submitted okay' ); - is $user->alerts->count, 0; +for my $cobrand (qw(westminster fixmystreet)) { + FixMyStreet::override_config { + ALLOWED_COBRANDS => $cobrand, + MAPIT_URL => 'http://mapit.uk/', + }, sub { + subtest "No reporter alert created in $cobrand" => sub { + my $user = $mech->log_in_ok('test@example.org'); + $mech->get_ok('/'); + $mech->submit_form_ok( { with_fields => { pc => 'SW1A1AA' } }, "submit location" ); + $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" ); + $mech->submit_form_ok( { with_fields => { + title => 'Title', detail => 'Detail', category => 'Abandoned bike', name => 'Test Example', + } }, 'submitted okay' ); + is $user->alerts->count, 0; + }; }; -}; +} my $westminster = FixMyStreet::Cobrand::Westminster->new; subtest 'correct config returned for USRN/UPRN lookup' => sub { |