Created
August 16, 2011 16:24
-
-
Save sugar84/1149473 to your computer and use it in GitHub Desktop.
mojo cookie bug or not?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use Mojolicious::Lite; | |
| any '/' => sub { | |
| my $self = shift; | |
| my $name = $self->param("name"); | |
| #cookie with value | |
| $self->cookie(baz => 'bar'); | |
| #cookie without value | |
| $self->cookie(foo => ''); | |
| return defined $name | |
| ? $self->render(text => $self->cookie($name)) | |
| : $self->render(text => "hello"); | |
| }; | |
| use Test::Mojo; | |
| use Test::More tests => 7; | |
| my $t = Test::Mojo->new; | |
| $t->get_ok('/'); | |
| $t->post_form_ok('/', { name => "baz"}) | |
| ->status_is(200) | |
| ->content_is('bar') | |
| ; | |
| $t->post_form_ok('/', { name => "foo"}) | |
| ->status_is(200) | |
| ->content_is('') | |
| ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment