aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2011-06-21 14:58:06 +0100
committerMatthew Somerville <matthew@mysociety.org>2011-06-21 14:58:06 +0100
commitd7d612b07c9d34985bb18410bcff1425c3eb2626 (patch)
treef5766219f0431c12fded27fd79dc1c899fc1ff34
parent82d392e62180ffd279f00c9e878c14b684577d86 (diff)
Fix #121 and tests for all today's fixes.
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm6
-rw-r--r--t/app/controller/admin.t24
2 files changed, 24 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 53852bcd1..abc454600 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -356,6 +356,12 @@ sub setup_council_details : Private {
return 1;
}
+sub council_edit_all : Path('council_edit') {
+ my ( $self, $c, $area_id, @category ) = @_;
+ my $category = join( '/', @category );
+ $c->go( 'council_edit', [ $area_id, $category ] );
+}
+
sub council_edit : Path('council_edit') : Args(2) {
my ( $self, $c, $area_id, $category ) = @_;
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index 74fb4ae33..60cbd6937 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -136,18 +136,17 @@ subtest 'check summary counts' => sub {
$mech->get_ok('/admin/council_contacts/2650');
$mech->content_contains('Aberdeen City Council');
$mech->content_contains('AB15 8RN');
+$mech->content_contains('street.com/around');
subtest 'check contact creation' => sub {
- my $contact = FixMyStreet::App->model('DB::Contact')->find(
- { area_id => 2650, category => 'test category' }
+ my $contact = FixMyStreet::App->model('DB::Contact')->search(
+ { area_id => 2650, category => [ 'test category', 'test/category' ] }
);
-
- $contact->delete if $contact;
+ $contact->delete_all;
my $history = FixMyStreet::App->model('DB::ContactsHistory')->search(
- { area_id => 2650, category => 'test category' }
+ { area_id => 2650, category => [ 'test category', 'test/category' ] }
);
-
$history->delete_all;
$mech->get_ok('/admin/council_contacts/2650');
@@ -161,6 +160,14 @@ subtest 'check contact creation' => sub {
$mech->content_contains( 'test category' );
$mech->content_contains( '<td>test@example.com' );
$mech->content_contains( '<td>test note' );
+
+ $mech->submit_form_ok( { with_fields => {
+ category => 'test/category',
+ email => 'test@example.com',
+ note => 'test/note',
+ } } );
+ $mech->get_ok('/admin/council_edit/2650/test/category');
+
};
subtest 'check contact editing' => sub {
@@ -194,6 +201,11 @@ subtest 'check contact updating' => sub {
$mech->content_like(qr{test2\@example.com[^<]*</td>[^<]*<td><strong>Yes}s);
};
+subtest 'check text output' => sub {
+ $mech->get_ok('/admin/council_contacts/2650?text=1');
+ is $mech->content_type, 'text/plain';
+ $mech->content_contains('test category');
+};
my $log_entries = FixMyStreet::App->model('DB::AdminLog')->search(
{