Test::Mojo can help you test your views and controllers, as well as your 
internal helpers:

https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Testing.pod#Testing-application-helpers

If you are wanting to test your application *model* (i.e., non-Mojolicious 
code), you should probably use standard Test::More to create an object, 
exercise its methods, etc.

Scott

On Monday, April 27, 2020 at 4:55:43 PM UTC-6, Alberto Mijares wrote:
>
> Hi guys, 
>
> I've been reading about testing and can't figure out how to test 
> internal methods; meaning those methods not directly associated to a 
> route. 
>
> I'm sure most of you know what I'm talking about but just for the 
> record. Let's say you have in App::Controller::This 
>
> sub list { 
> my $self = shift; 
> $self->render(text => $self->filter($value)); 
> } 
>
> sub filter { 
> my $self = shift; 
> for @list {push (@final, $line) if ($line =~ /something/);} 
> return \@final 
> } 
>
> And in lib/App.pm you have 
>
> $c->get('/list)->to('this#list'); 
>
> So, I want to test returned values from App::Controller::This->filter. 
>
> Thanks in advance for your help. 
>
>
> Alberto Mijares 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/6fd72956-78ed-4922-bf30-e3cad431e5e0%40googlegroups.com.

Reply via email to