aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/model/comment.t
blob: dd9af9eb9ddde789abc3a176ff3876efa9e42f44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use FixMyStreet::Test;

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 => $user,
        problem_id   => 1,
        text         => '',
    }
);

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();