aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/model
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-10-06 14:10:23 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-10-11 16:17:32 +0100
commit662b96c2539ec4f61d7ae84b07bb8cebdae02741 (patch)
tree1519e4a912fdc839a0246020d9651ba3561ad026 /t/app/model
parente1038dac8f5ba0fe2f20781468b3cbe763b7ed68 (diff)
Adding report to shortlist removes from others.
Diffstat (limited to 't/app/model')
-rw-r--r--t/app/model/user_planned_report.t14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/app/model/user_planned_report.t b/t/app/model/user_planned_report.t
index a9c2ee9b5..95a76615e 100644
--- a/t/app/model/user_planned_report.t
+++ b/t/app/model/user_planned_report.t
@@ -11,6 +11,7 @@ my $mech = FixMyStreet::TestMech->new();
my @problems = $mech->create_problems_for_body(1, 2237, 'Title');
my $problem = $problems[0];
my $user = $problem->user;
+my $user2 = $mech->create_user_ok('other@example.net');
is $user->active_planned_reports, 0;
is $user->planned_reports, 0;
@@ -31,8 +32,21 @@ $user->add_to_planned_reports($problem);
is $user->active_planned_reports, 1;
is $user->planned_reports, 2;
+$user2->add_to_planned_reports($problem);
+is $user->active_planned_reports, 0;
+is $user->planned_reports, 2;
+is $user2->active_planned_reports, 1;
+is $user2->planned_reports, 1;
+
+$user->add_to_planned_reports($problem);
+is $user->active_planned_reports, 1;
+is $user->planned_reports, 3;
+is $user2->active_planned_reports, 0;
+is $user2->planned_reports, 1;
+
done_testing();
END {
$mech->delete_user($user);
+ $mech->delete_user($user2);
}