Pagini recente » Cod sursa (job #2640365) | Cod sursa (job #438026) | Cod sursa (job #1832215) | Cod sursa (job #2394649) | Cod sursa (job #3005294)
subtest "Check username colors for xp tops" => sub {
$t->reset_session;
$t->get_ok('/test/set-admin');
// use this array to update and test the username color for all periods
my @xp_periods = @SuperSecret::Helper::XpLog::xp_ranking_periods;
// update the xp of the user
my $index = 0;
for my $period (@xp_periods) {
$t->app->db->resultset('XpRanking')->create({
period => $period, username => 'user', xp => 2000
});
++$index;
}
# update the rating of the user
$t->app->db->resultset('User')->by_username('user')
->update({ rating => 2700 });
for my $period (@xp_periods) {
# open the xp 'period' top page and check
# if the color is corresponding to the rating
$t->get_ok('/top/users/xp/' . lc($period))->status_is(200)
->content_like(qr/user".*style="color: #FF3333;">/s);
}
};
done_testing();