aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/model/comment.t
diff options
context:
space:
mode:
Diffstat (limited to 't/app/model/comment.t')
-rw-r--r--t/app/model/comment.t25
1 files changed, 16 insertions, 9 deletions
diff --git a/t/app/model/comment.t b/t/app/model/comment.t
index 3f30b3a1e..dd9af9eb9 100644
--- a/t/app/model/comment.t
+++ b/t/app/model/comment.t
@@ -1,20 +1,27 @@
use FixMyStreet::Test;
-my $comment_rs = FixMyStreet::DB->resultset('Comment');
+my $user = FixMyStreet::DB->resultset('User')->new({ name => 'Test User', is_superuser => 1 });
+my $comment_rs = FixMyStreet::DB->resultset('Comment');
my $comment = $comment_rs->new(
{
- user_id => 1,
+ user => $user,
problem_id => 1,
text => '',
- state => 'confirmed',
- anonymous => 0,
- mark_fixed => 0,
- cobrand => 'default',
- cobrand_data => '',
}
);
-is $comment->confirmed, undef, 'inflating null confirmed ok';
-is $comment->created, undef, 'inflating null confirmed ok';
+is $comment->created, undef, 'inflating null created ok';
+is $comment->mark_fixed, 0, 'mark fixed default set';
+is $comment->state, 'confirmed', 'state default is confirmed';
+is $comment->name, 'an administrator';
+
+$user->is_superuser(0);
+$comment = $comment_rs->new({
+ user => $user,
+ problem_id => 1,
+ text => '',
+});
+is $comment->name, 'Test User';
+
done_testing();