Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
do not encourage testing of custom transactions
  • Loading branch information
kraih committed Oct 9, 2015
1 parent 9642fb7 commit f4049c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/UserAgent.pm
Expand Up @@ -253,7 +253,7 @@ sub _finish {
# Finish WebSocket
return $self->_remove($id, 1) if $old->is_websocket;

if (my $jar = $self->cookie_jar) { $jar->collect($old) }
$self->cookie_jar->collect($old);

# Upgrade connection to WebSocket
if (my $new = $self->transactor->upgrade($old)) {
Expand Down
6 changes: 2 additions & 4 deletions lib/Test/Mojo.pm
Expand Up @@ -259,7 +259,7 @@ sub request_ok { shift->_request_ok($_[0], $_[0]->req->url->to_string) }

sub reset_session {
my $self = shift;
if (my $jar = $self->ua->cookie_jar) { $jar->empty }
$self->ua->cookie_jar->empty;
return $self->tx(undef);
}

Expand Down Expand Up @@ -497,9 +497,7 @@ L<Mojo::Transaction::WebSocket> object.
# More specific tests
is $t->tx->res->json->{foo}, 'bar', 'right value';
ok $t->tx->res->content->is_multipart, 'multipart content';
# Test custom transactions
$t->tx($t->tx->previous)->status_is(302)->header_like(Location => qr/foo/);
is $t->tx->previous->res->code, 302, 'right status';
=head2 ua
Expand Down
7 changes: 4 additions & 3 deletions t/mojolicious/lite_app.t
Expand Up @@ -969,9 +969,10 @@ $t->get_ok('/redirect_named')->status_is(200)
->text_is('div#☃' => 'Redirect works!')->text_unlike('div#☃' => qr/Foo/)
->text_like('div#☃' => qr/^Redirect/);
$t->ua->max_redirects(0);
Test::Mojo->new->tx($t->tx->previous)->status_is(302)
->header_is(Server => 'Mojolicious (Perl)')
->header_like(Location => qr!/template.txt$!)->content_is('');
is $t->tx->previous->res->code, 302, 'right status';
like $t->tx->previous->res->headers->location, qr!/template.txt$!,
'right "Location" value';
is $t->tx->previous->res->body, '', 'right content';

# Request with koi8-r content
my $koi8
Expand Down

0 comments on commit f4049c1

Please sign in to comment.