AnyEvent-WebService-Tracks
view release on metacpan or search on metacpan
t/04-todo.t view on Meta::CPAN
};
dies_ok {
$one->description;
};
dies_ok {
$one->notes;
};
dies_ok {
$one->due;
};
dies_ok {
$one->show_from;
};
dies_ok {
$one->id;
};
dies_ok {
$one->completed_at;
};
dies_ok {
$one->recurring_todo_id;
};
dies_ok {
$one->created_at;
};
dies_ok {
$one->updated_at;
};
dies_ok {
$one->context(sub {
fail("I shouldn't get called!");
});
};
dies_ok {
$one->project(sub {
fail("I shouldn't get called!");
});
};
dies_ok {
$one->update(sub {
fail("I shouldn't get called!");
});
};
dies_ok {
$one->destroy(sub {
fail("I shouldn't get called!");
});
};
$cond->send;
});
});
};
run_tests_in_loop {
my ( $cond ) = @_;
$tracks->create_todo('Foobar 2', $ctx, sub {
my ( $todo ) = @_;
# we do this to make sure the update time is in the future
my $timer;
$timer = AnyEvent->timer(
after => 1,
cb => sub {
undef $timer;
my $old_updated = $todo->updated_at;
$todo->description('Foobar 23');
$todo->notes('Some notes!');
is($todo->description, 'Foobar 23');
is($todo->notes, 'Some notes!');
$todo->update(sub {
my ( $todo2 ) = @_;
is($todo2, $todo);
is($todo2->description, 'Foobar 23');
is($todo2->notes, 'Some notes!');
isnt($todo2->updated_at, $old_updated);
ok($todo2->updated_at > $old_updated);
$cond->send;
});
},
);
});
};
run_tests_in_loop {
my ( $cond ) = @_;
$tracks->create_project('One', sub {
my ( $one ) = @_;
$tracks->create_project('Two', sub {
my ( $two ) = @_;
$tracks->create_todo(context => $ctx, project => $one, description => 'Test todo', sub {
my ( $todo ) = @_;
ok($todo);
$todo->project(sub {
my ( $p ) = @_;
is($p->id, $one->id);
$todo->project($two);
$todo->update(sub {
my ( $todo ) = @_;
$todo->project(sub {
my ( $p ) = @_;
is($p->id, $two->id);
$todo->project(undef);
$todo->update(sub {
my ( $todo ) = @_;
$todo->project(sub {
my ( $p ) = @_;
( run in 1.593 second using v1.01-cache-2.11-cpan-39bf76dae61 )