2009/1/26 kirk beers <[email protected]>: > Hi folks, > > I am fairly new to Catalyst and Perl (conformed Java programmer), I was > wondering if anyone could help me with and issue with > WWW::Mechanize::Catalyst::Test > > specifically : > $mech->content_contains($str,[,$desc]); > > I have added a wrapper.tt and set it in my view/HTML.pm. This wrapper > contains access to my common files .css and images with the following tag [% > content %]. Next I have a message.tt which is accessed from my controller > subroutines by: > > $c->stash->{message} = 'Something went wrong!'; > $c->stash->{template} = 'message.tt'; > > When I use the $mech->content_contains('There was missing info or the > passwords did not match!','Test for missing username to add user'); > > I get the following error stating it can't find the message text. > > not ok 12 - Test for missing username to add user > > # Failed test 'Test for missing username to add user' > # at t/controller_Admin-User.t line 25. > # searched: "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric"... > # can't find: "There was missing info or the passwords did not ma"... > 1..12 > # Looks like you failed 1 test of 12.
That means the string you are searching for isn't present in the response body. I suspect you're either getting something different back than you expected (e.g. an error page) or the string you have supplied in the test doesn't match exactly with the error you're generating in the HTML (e.g. a typo). Dumping out the results of $mech->content to see what exactly output you produced should pinpoint the problem. _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
