I'm using Test::Mojo to test a course website.
InstructorFilesetdue.pm looks like this:
get '/instructor/filesetdue' => sub {
my $c = shift;
... # change the due
$c->redirect_to($c->req->headers->referrer); # this should redirect me back to the /instructor/filecenter
};
So in real operation, after I click the button and change the due, I should come back to /instructor/filecenter.
But for the test object $t, when I write:
->content_like(qr/file center, not filesetdue or login/)
I can change the due but $t ends up at the login page of my course website (As I found out, when executing $c->redirect_to($c->req->headers->referrer), $c->req->headers->referrer is actually uninitialized, so redirect_to() will direct me to "/", which then prompts to /login page).
My question is, how can I tell the test object it comes from /instructor/filecenter and that should be the referrer?
Thanks!
Ni