RT 4.0.22
[freeside.git] / rt / t / web / current_user_outdated_email.t
1
2 use strict;
3 use warnings;
4 use RT::Test tests => 39;
5
6 my ( $url, $m ) = RT::Test->started_ok;
7
8 $m->login();
9
10 my @links = (
11     '/',                                '/Ticket/Create.html?Queue=1',
12     '/SelfService/Create.html?Queue=1', '/m/ticket/create?Queue=1'
13 );
14
15 my $root = RT::Test->load_or_create_user( Name => 'root' );
16 ok( $root->id, 'loaded root' );
17 is( $root->EmailAddress, 'root@localhost', 'default root email' );
18
19 for my $link (@links) {
20     $m->get_ok($link);
21     $m->content_contains( '"root@localhost"', "default email in $link" );
22 }
23
24 $root->SetEmailAddress('foo@example.com');
25 is( $root->EmailAddress, 'foo@example.com', 'changed to foo@example.com' );
26
27 for my $link (@links) {
28     $m->get_ok($link);
29     $m->content_lacks( '"root@localhost"', "no default email in $link" );
30     $m->content_contains( '"foo@example.com"', "new email in $link" );
31 }
32
33 $root->SetEmailAddress('root@localhost');
34 is( $root->EmailAddress, 'root@localhost', 'changed back to root@localhost' );
35
36 for my $link (@links) {
37     $m->get_ok($link);
38     $m->content_lacks( '"foo@example.com"', "no previous email in $link" );
39     $m->content_contains( '"root@localhost"', "default email in $link" );
40 }
41