Pelle: you could just use $t->tx->res after $t->get_ok(): $t->get_ok($t->tx->res->headers->location);
On Monday, September 1, 2014 8:50:25 AM UTC+2, Pelle wrote: > > Hi. > > When using Test::Mojo sometimes you want to extract some info the rendered > data. The standard way to do that is installing an "after_render" hook. > > I would like to propose a more integrated way to do this, so you could > have different "peek/extract" methods in the "test chain", like: > > my $t = Test::Mojo->new; > my $location; > > $t->post_ok('/users' => { name => 'John Doe', age => 42 }) > ->status_is(201) # created > ->header_like(Location => qr!/users/\d+!) > ->peek(sub { my $res = shift; $location = $res->headers->location }); > > $t->get_ok($location) > ->status_is(200) > ->content_like(qr!user = John Doe!) > ->content_like(qr!age = 42!); > > The sub in the "peek" method is passed one object, the current > "Mojo::Message::Response" object. > > The use case is ease testing of routes which do create resources. > > > > On 25 August 2014 20:15, Jan Henning Thorsen <jan.henn...@thorsen.pm> > wrote: > >> Viktor: Mojolicious::Plugin::Bootstrap3 include styling for " >> field-with-error": >> https://metacpan.org/pod/Mojolicious::Plugin::Bootstrap3#Non-standard-files >> >> >> On Mon, Aug 25, 2014 at 7:34 PM, sri <kra...@googlemail.com> wrote: >> >>> Making 'field-with-error' something you can set, e.g. >>>> >>>> app->validator->error_class('has-error') >>>> >>> >>> There's already a helper that can be redefined. >>> >>> >>> http://mojolicio.us/perldoc/Mojolicious/Plugin/TagHelpers#tag_with_error >>> >>> -- >>> sebastian >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Mojolicious" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/mojolicious/mIRRwNwDLSE/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> mojolicious+unsubscr...@googlegroups.com. >>> >>> To post to this group, send email to mojolicious@googlegroups.com. >>> Visit this group at http://groups.google.com/group/mojolicious. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Mojolicious" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to mojolicious+unsubscr...@googlegroups.com. >> To post to this group, send email to mojolicious@googlegroups.com. >> Visit this group at http://groups.google.com/group/mojolicious. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Pelle > > Research is what I'm doing when I don't know what I'm doing. > - Wernher von Braun > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.