Skip to content

Commit

Permalink
Session cleanup for t/Exception/app.t
Browse files Browse the repository at this point in the history
  • Loading branch information
perlDreamer committed Jun 24, 2010
1 parent d6be3a1 commit 808f38b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions t/Exception/app.t
Expand Up @@ -19,19 +19,17 @@ my $regular_app = builder {
};

my $generic_dead_app = builder {
enable '+WebGUI::Middleware::Session', config => $wg->config;
enable '+WebGUI::Middleware::HTTPExceptions';

# Pretend that WebGUI dies during request handling
sub { die 'WebGUI died' }
};

my $specific_dead_app = builder {
enable '+WebGUI::Middleware::Session', config => $wg->config;
enable '+WebGUI::Middleware::HTTPExceptions';

# Pretend that WebGUI throws a '501 - Not Implemented' HTTP error
sub { HTTP::Exception->throw(501) }
sub { HTTP::Exception->throw(501) };
};

my $fatal_app = builder {
Expand All @@ -42,6 +40,7 @@ my $fatal_app = builder {
sub {
my $env = shift;

WebGUI::Test->addToCleanup($env->{'webgui.session'});
$env->{'webgui.session'}->log->fatal('Fatally yours');
}
};
Expand All @@ -50,7 +49,11 @@ my $not_found_app = builder {
enable '+WebGUI::Middleware::Session', config => $wg->config;
enable '+WebGUI::Middleware::HTTPExceptions';

sub { HTTP::Exception->throw(404) }
sub {
my $env = shift;
WebGUI::Test->addToCleanup($env->{'webgui.session'});
HTTP::Exception->throw(404)
};
};

test_psgi $regular_app, sub {
Expand Down

0 comments on commit 808f38b

Please sign in to comment.