AnyEvent-WebService-Tracks
view release on metacpan or search on metacpan
t/02-context.t view on Meta::CPAN
$tracks->contexts(sub {
my ( $contexts ) = @_;
my ( $one ) = @$contexts;
$one->name('Not one');
$one->position(4);
$one->unhide;
my $updated_at = $one->updated_at;
my $timer;
$timer = AnyEvent->timer(
after => 2,
cb => sub {
undef $timer;
$one->update(sub {
my ( $ctx ) = @_;
ok($ctx);
is($ctx->name, 'Not one');
is($ctx->position, 4);
ok(! $ctx->is_hidden);
ok($ctx->updated_at > $updated_at);
$cond->send;
t/03-project.t view on Meta::CPAN
$tracks->projects(sub {
my ( $projects ) = @_;
my ( $one ) = @$projects;
$one->name('Not one');
$one->description('A different description');
$one->position(3);
my $updated_at = $one->updated_at;
my $timer;
$timer = AnyEvent->timer(
after => 2,
cb => sub {
undef $timer;
$one->update(sub {
my ( $proj ) = @_;
ok($proj);
is($proj->name, 'Not one');
is($proj->description, 'A different description');
is($proj->position, 3);
ok($proj->updated_at > $updated_at);
$cond->send;
t/04-todo.t view on Meta::CPAN
});
};
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 ) = @_;
t/lib/Test/AnyEvent/WebService/Tracks.pm view on Meta::CPAN
$tracks->todos($clear_todos);
$cond->recv;
}
sub run_tests_in_loop (&) {
my ( $cb ) = @_;
my ( undef, $file, $line ) = caller;
my $cond = AnyEvent->condvar;
my $timer_has_fired = 0;
my $timer = AnyEvent->timer(
after => 30,
cb => sub {
$timer_has_fired = 1;
Test::More::fail("Timeout at $file, line $line");
$cond->send;
},
);
eval {
$cb->($cond);
};
if($@) {
Test::More::fail($@);
} else {
$cond->recv;
Test::More::pass unless $timer_has_fired;
}
}
sub import {
my ( undef, @args ) = @_;
my $pkg = caller;
no strict 'refs';
foreach (@Test::More::EXPORT) {
( run in 1.283 second using v1.01-cache-2.11-cpan-49f99fa48dc )