aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-12-13 21:18:46 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-12-15 00:11:06 +0000
commit0b94fccf4d41d674c9544b17983ed6bba12ddf95 (patch)
tree141e8089ef2981974b46a000916a07c9d15cd538
parentce9e6afbb9cc24015b7e4649f43d5c4d09805021 (diff)
Fix for a missed council column rename, and a test that would have caught it.
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Rss.pm2
-rw-r--r--t/app/controller/rss.t63
2 files changed, 64 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm
index b275cfcf7..8a43c0315 100755
--- a/perllib/FixMyStreet/App/Controller/Rss.pm
+++ b/perllib/FixMyStreet/App/Controller/Rss.pm
@@ -257,7 +257,7 @@ sub add_row : Private {
my $hashref_restriction = $c->cobrand->site_restriction;
my $base_url = $c->cobrand->base_url;
- if ( $hashref_restriction && $hashref_restriction->{council} && $row->{bodies_str} && $row->{bodies_str} ne $hashref_restriction->{council} ) {
+ if ( $hashref_restriction && $hashref_restriction->{bodies_str} && $row->{bodies_str} && $row->{bodies_str} ne $hashref_restriction->{bodies_str} ) {
$base_url = $c->config->{BASE_URL};
}
my $url = $base_url . $link;
diff --git a/t/app/controller/rss.t b/t/app/controller/rss.t
index e683806cd..002d63d67 100644
--- a/t/app/controller/rss.t
+++ b/t/app/controller/rss.t
@@ -113,6 +113,69 @@ $mech->content_contains( "Testing, 10th October" );
$mech->content_contains( '18 North Bridge, Edinburgh' );
$report->delete();
+
+my $now = DateTime->now();
+my $report_to_council = FixMyStreet::App->model('DB::Problem')->find_or_create(
+ {
+ postcode => 'WS13 6YY',
+ bodies_str => '2434',
+ areas => ',2434,2240,',
+ category => 'Other',
+ title => 'council report',
+ detail => 'Test 2 Detail',
+ used_map => 't',
+ name => 'Test User',
+ anonymous => 'f',
+ state => 'closed',
+ confirmed => $now->ymd . ' ' . $now->hms,
+ lang => 'en-gb',
+ service => '',
+ cobrand => 'default',
+ cobrand_data => '',
+ send_questionnaire => 't',
+ latitude => '52.727588',
+ longitude => '-1.731322',
+ user_id => $user1->id,
+ }
+);
+
+my $report_to_county_council = FixMyStreet::App->model('DB::Problem')->find_or_create(
+ {
+ postcode => 'WS13 6YY',
+ bodies_str => '2240',
+ areas => ',2434,2240,',
+ category => 'Other',
+ title => 'county report',
+ detail => 'Test 2 Detail',
+ used_map => 't',
+ name => 'Test User',
+ anonymous => 'f',
+ state => 'closed',
+ confirmed => $now->ymd . ' ' . $now->hms,
+ lang => 'en-gb',
+ service => '',
+ cobrand => 'default',
+ cobrand_data => '',
+ send_questionnaire => 't',
+ latitude => '52.727588',
+ longitude => '-1.731322',
+ user_id => $user1->id,
+ }
+);
+
+subtest "check RSS feeds on cobrand have correct URLs for non-cobrand reports" => sub {
+ $mech->host('lichfielddc.fixmystreet.com');
+ $mech->get_ok("/rss/area/Lichfield");
+
+ my $expected1 = mySociety::Config::get('BASE_URL') . '/report/' . $report_to_county_council->id;
+ my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('lichfielddc')->new();
+ my $expected2 = $cobrand->base_url . '/report/' . $report_to_council->id;
+
+ $mech->content_contains($expected1, 'non cobrand area report point to fixmystreet.com');
+ $mech->content_contains($expected2, 'cobrand area report point to cobrand url');
+};
+
+$user1->problems->delete();
$user1->delete();
done_testing();