Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
test that transaction is still available after rendering early
  • Loading branch information
kraih committed Jun 30, 2014
1 parent a0dba11 commit bedb49f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions t/mojolicious/steps_lite_app.t
Expand Up @@ -38,6 +38,20 @@ get '/nested' => sub {
);
};

my $early;
get '/early' => sub {
my $c = shift;
$c->render_steps(
sub { Mojo::IOLoop->next_tick(shift->begin) },
sub {
Mojo::IOLoop->next_tick(shift->begin);
$c->render(text => 'second');
$c->res->headers->header('X-Next' => 'third');
},
sub { $early = $c->res->headers->header('X-Next') }
);
};

get '/not_found' => sub {
my $c = shift;
$c->render_steps(
Expand Down Expand Up @@ -72,6 +86,11 @@ $t->get_ok('/steps?auto=1')->status_is(200)
# Nested steps
$t->get_ok('/nested')->status_is(200)->content_is('action');

# Transaction is available after rendering early
$t->get_ok('/early')->status_is(200)->content_is('second');
Mojo::IOLoop->one_tick until $early;
is $early, 'third', 'right result';

# Template not found
$t->get_ok('/not_found')->status_is(404);

Expand Down

0 comments on commit bedb49f

Please sign in to comment.