diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UK.pm | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UKCouncils.pm | 4 | ||||
-rw-r--r-- | t/Mock/MapIt.pm | 2 | ||||
-rw-r--r-- | t/cobrand/greenwich.t | 25 |
4 files changed, 30 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/Cobrand/UK.pm b/perllib/FixMyStreet/Cobrand/UK.pm index fde5f465a..18bf01476 100644 --- a/perllib/FixMyStreet/Cobrand/UK.pm +++ b/perllib/FixMyStreet/Cobrand/UK.pm @@ -107,7 +107,7 @@ sub short_name { return 'Durham+County' if $name eq 'Durham County Council'; return 'Durham+City' if $name eq 'Durham City Council'; - $name =~ s/^London Borough of //; + $name =~ s/^(Royal|London) Borough of //; $name =~ s/ (Borough|City|District|County) Council$//; $name =~ s/ Council$//; $name =~ s/ & / and /; @@ -140,8 +140,8 @@ sub find_closest { sub reports_body_check { my ( $self, $c, $code ) = @_; - # Deal with Bexley name not starting with short name - if ($code =~ /bexley/i) { + # Deal with Bexley and Greenwich name not starting with short name + if ($code =~ /bexley|greenwich/i) { my $body = $c->model('DB::Body')->search( { name => { -like => "%$code%" } } )->single; $c->stash->{body} = $body; return $body; diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index 5f45609bb..81e5dd569 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -171,8 +171,8 @@ sub all_reports_single_body { sub reports_body_check { my ( $self, $c, $code ) = @_; - # Deal with Bexley name not starting with short name - if ($code =~ /bexley/i) { + # Deal with Bexley/Greenwich name not starting with short name + if ($code =~ /bexley|greenwich/i) { my $body = $c->model('DB::Body')->search( { name => { -like => "%$code%" } } )->single; $c->stash->{body} = $body; return $body; diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm index 67e0a5364..c6e9b0af8 100644 --- a/t/Mock/MapIt.pm +++ b/t/Mock/MapIt.pm @@ -116,6 +116,8 @@ sub dispatch_request { $self->output({2326 => {parent_area => undef, id => 2326, name => "Cheltenham Borough Council", type => "DIS"}}); } elsif ($areas eq 'UTA') { $self->output({2650 => {parent_area => undef, id => 2650, name => "Aberdeen Council", type => "UTA"}}); + } elsif ($areas eq 'GRE') { + $self->output({2493 => {parent_area => undef, id => 2493, name => "Greenwich Borough Council", type => "LBO"}}); } }, diff --git a/t/cobrand/greenwich.t b/t/cobrand/greenwich.t index e6aaca973..14ddba9be 100644 --- a/t/cobrand/greenwich.t +++ b/t/cobrand/greenwich.t @@ -5,7 +5,7 @@ use Open311::PopulateServiceList; my $mech = FixMyStreet::TestMech->new; -my $body = $mech->create_body_ok( 2493, 'Greenwich Council', { +my $body = $mech->create_body_ok( 2493, 'Royal Borough of Greenwich', { send_method => 'Open311', endpoint => 'endpoint', api_key => 'key', @@ -110,5 +110,26 @@ subtest 'testing special Open311 behaviour', sub { is $c->param('attribute[easting]'), 529025, 'Request had correct easting'; }; -done_testing(); +subtest 'RSS feed on .com' => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => 'fixmystreet', + MAPIT_TYPES => ['GRE'], + MAPIT_URL => 'http://mapit.uk/', + }, sub { + $mech->get_ok('/rss/reports/Greenwich'); + is $mech->uri->path, '/rss/reports/Greenwich'; + }; +}; +subtest 'RSS feed on Greenwich' => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => 'greenwich', + MAPIT_TYPES => ['GRE'], + MAPIT_URL => 'http://mapit.uk/', + }, sub { + $mech->get_ok('/rss/reports/Greenwich'); + is $mech->uri->path, '/rss/reports/Greenwich'; + }; +}; + +done_testing(); |