diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-09-25 09:59:35 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-09-25 09:59:35 +0100 |
commit | 2415d881317b8262c26720fa4d8c6c9757d1c345 (patch) | |
tree | 560bc9040205ce06913c43c953cf48e44556645d | |
parent | 2a96f054e51a1a0e8319cc0a0c09b309d91439c2 (diff) |
Fix Bromley use of 'no further action'.
If SET isn't given, the line means [% foo = ('bar' IF baz) %]
rather than [% ([SET] foo = 'bar') IF baz %].
-rw-r--r-- | t/cobrand/bromley.t | 45 | ||||
-rw-r--r-- | templates/web/default/report/updates.html | 4 |
2 files changed, 47 insertions, 2 deletions
diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t new file mode 100644 index 000000000..cb2086a84 --- /dev/null +++ b/t/cobrand/bromley.t @@ -0,0 +1,45 @@ +use strict; +use warnings; +use Test::More; + +plan skip_all => 'Skipping Bromley test without Bromley cobrand' + unless FixMyStreet::Cobrand->exists('bromley'); + +use FixMyStreet::TestMech; +my $mech = FixMyStreet::TestMech->new; + +# Create test data +my $user = $mech->create_user_ok( 'bromley@example.com' ); +my $body = $mech->create_body_ok( 2482, 'Bromley' ); + +my @reports = $mech->create_problems_for_body( 1, 2482, 'Test', { + cobrand => 'bromley', + user => $user, +}); +my $report = $reports[0]; + +for my $update ('in progress', 'unable to fix') { + FixMyStreet::App->model('DB::Comment')->find_or_create( { + problem_state => $update, + problem_id => $report->id, + user_id => $user->id, + name => 'User', + mark_fixed => 'f', + text => "This update marks it as $update", + state => 'confirmed', + confirmed => 'now()', + anonymous => 'f', + } ); +} + +# Test Bromley special casing of 'unable to fix' +$mech->get_ok( '/report/' . $report->id ); +$mech->content_contains( 'marks it as in progress' ); +$mech->content_contains( 'marked as in progress' ); +$mech->content_contains( 'marks it as unable to fix' ); +$mech->content_contains( 'marked as no further action' ); + +# Clean up +$mech->delete_user($user); +$mech->delete_problems_for_body( 2482 ); +done_testing(); diff --git a/templates/web/default/report/updates.html b/templates/web/default/report/updates.html index 9134c34f8..b0a015f03 100644 --- a/templates/web/default/report/updates.html +++ b/templates/web/default/report/updates.html @@ -30,8 +30,8 @@ [%- IF !update_state && update.problem_state %] [%- state = update.meta_problem_state %] [%- IF c.cobrand.moniker == 'bromley' OR problem.bodies_str == '2482' %] - [%- update_state = 'marked as no further action' IF state == 'unable to fix' %] - [%- update_state = 'marked as third party responsibility' IF state == 'not responsible' %] + [%- SET update_state = 'marked as no further action' IF state == 'unable to fix' %] + [%- SET update_state = 'marked as third party responsibility' IF state == 'not responsible' %] [%- END %] [%- END %] [%- IF !update_state && update.problem_state %] |