| Revision 34 (by dpavlin, 2007/12/14 14:39:05) |
more tweaks on toggle edit to make it (partially) working -- it
works in tests, but reports wrong message (?!) |
#!/usr/bin/env perl
use warnings;
use strict;
=head1 DESCRIPTION
A (very) basic test harness for the ToggleEdit action.
=cut
use Jifty::Test tests => 20;
use Data::Dump qw/dump/;
# Make sure we can load the action
use_ok('Arh::Action::ToggleEdit');
ok( my $web = Jifty::Test->web, 'web' );
ok( $web->current_user->user_object->load_by_cols( email => 'admin@example.com' ), 'admin' );
ok( $web->current_user->editing, 'edit on' );
sub run_action {
ok(my $a = $web->new_action(
class => 'ToggleEdit',
), 'new_action ToggleEdit');
ok( $a->run, 'run' );
ok( my $message = $a->result->message, 'message' );
diag dump($message);
if ( $message =~ m/off/ ) {
ok( ! $web->current_user->editing, 'edit off' );
} else {
ok( $web->current_user->editing, 'edit on' );
}
}
run_action foreach ( 1 .. 4 );