Do not want to disable Middleware and yet get the test to green
My test is as follows:
/** @test */
public function guests_cannot_create_quiz() {
//$this->withoutMiddleware();
$this->post('/quiz/store', [])
->assertRedirect('/register');
}
I'm trying to post an empty array to my route and I expect the system to redirect the user to login page. While I'm not exactly sure if that's the right assertion to make; I'm now thinking maybe I should assert for an exception.
In either case, my controller isn't throwing the right error; which I believe should be 'authentication' exception.
Here's what I'm getting:
Response status code [419] is not a redirect status code.
Failed asserting that false is true.
If I disable the middleware, I get status code [200], because the system ignores the auth middleware and lets the user post.