aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
Diffstat (limited to 't/app')
-rw-r--r--t/app/controller/admin.t2
-rw-r--r--t/app/model/problem.t14
2 files changed, 16 insertions, 0 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index 7ba84b652..a0e013459 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -1453,6 +1453,7 @@ subtest "response priorities can be added" => sub {
my $fields = {
name => "Cat 1A",
+ description => "Fixed within 24 hours",
deleted => undef,
"contacts[".$oxfordshirecontact->id."]" => 1,
};
@@ -1466,6 +1467,7 @@ subtest "response priorities can be listed" => sub {
$mech->get_ok( "/admin/responsepriorities/" . $oxfordshire->id );
$mech->content_contains( $oxfordshire->response_priorities->first->name );
+ $mech->content_contains( $oxfordshire->response_priorities->first->description );
};
subtest "response priorities are limited by body" => sub {
diff --git a/t/app/model/problem.t b/t/app/model/problem.t
index 836e8a047..bd7d0e55c 100644
--- a/t/app/model/problem.t
+++ b/t/app/model/problem.t
@@ -749,6 +749,20 @@ subtest 'check reports from abuser not sent' => sub {
ok $abuse->delete(), 'user removed from abuse table';
};
+subtest 'check response templates' => sub {
+ my $c1 = $mech->create_contact_ok(category => 'Potholes', body_id => $body_ids{2651}, email => 'p');
+ my $c2 = $mech->create_contact_ok(category => 'Graffiti', body_id => $body_ids{2651}, email => 'g');
+ my $t1 = FixMyStreet::DB->resultset('ResponseTemplate')->create({ body_id => $body_ids{2651}, title => "Title 1", text => "Text 1" });
+ my $t2 = FixMyStreet::DB->resultset('ResponseTemplate')->create({ body_id => $body_ids{2651}, title => "Title 2", text => "Text 2" });
+ my $t3 = FixMyStreet::DB->resultset('ResponseTemplate')->create({ body_id => $body_ids{2651}, title => "Title 3", text => "Text 3" });
+ $t1->add_to_contacts($c1);
+ $t2->add_to_contacts($c2);
+ my ($problem) = $mech->create_problems_for_body(1, $body_ids{2651}, 'TITLE');
+ is $problem->response_templates, 1, 'Only the global template returned';
+ ($problem) = $mech->create_problems_for_body(1, $body_ids{2651}, 'TITLE', { category => 'Potholes' });
+ is $problem->response_templates, 2, 'Global and pothole templates returned';
+};
+
END {
$problem->comments->delete if $problem;
$problem->delete if $problem;