1 |
dpavlin |
23 |
#!/usr/bin/env perl |
2 |
|
|
use warnings; |
3 |
|
|
use strict; |
4 |
|
|
|
5 |
|
|
=head1 DESCRIPTION |
6 |
|
|
|
7 |
|
|
A (very) basic test harness for the ToggleEdit action. |
8 |
|
|
|
9 |
|
|
=cut |
10 |
|
|
|
11 |
|
|
use Jifty::Test tests => 10; |
12 |
|
|
use Data::Dump qw/dump/; |
13 |
|
|
|
14 |
|
|
# Make sure we can load the action |
15 |
|
|
use_ok('Arh::Action::ToggleEdit'); |
16 |
|
|
|
17 |
|
|
|
18 |
|
|
ok( my $web = Jifty::Test->web, 'web' ); |
19 |
|
|
|
20 |
|
|
ok( $web->current_user->user_object->load_by_cols( email => 'admin@example.com' ), 'admin' ); |
21 |
|
|
|
22 |
|
|
ok( ! $web->current_user->editing, 'edit off' ); |
23 |
|
|
|
24 |
|
|
sub run_action { |
25 |
|
|
|
26 |
|
|
ok(my $a = $web->new_action( |
27 |
|
|
class => 'ToggleEdit', |
28 |
|
|
), 'new_action ToggleEdit'); |
29 |
|
|
|
30 |
|
|
ok( $a->run, 'run' ); |
31 |
|
|
|
32 |
|
|
} |
33 |
|
|
|
34 |
|
|
run_action; |
35 |
|
|
ok( $web->current_user->editing, 'edit on' ); |
36 |
|
|
|
37 |
|
|
run_action; |
38 |
|
|
ok( ! $web->current_user->editing, 'edit off' ); |
39 |
|
|
|