create(); get(route('entry-flags.confirmNoShow', ['entry_id' => $entry->id])) ->assertRedirect(route('home')); actAsNormal(); get(route('entry-flags.confirmNoShow', ['entry_id' => $entry->id])) ->assertRedirect(route('dashboard')) ->assertSessionHas('error', 'You are not authorized to perform this action'); actAsTab(); get(route('entry-flags.confirmNoShow', ['entry_id' => $entry->id])) ->assertOk(); actAsAdmin(); get(route('entry-flags.confirmNoShow', ['entry_id' => $entry->id])) ->assertOk(); }); it('has information for the requested entry', function () { // Arrange $entry = Entry::factory()->create(); // Act & Assert actAsTab(); get(route('entry-flags.confirmNoShow', ['entry_id' => $entry->id])) ->assertOk() ->assertSee($entry->student->full_name()) ->assertSee($entry->audition->name) ->assertSee($entry->student->school->name) ->assertSee($entry->draw_number); }); it('posts to entry-flags.enterNoShow and has a submit button', function () { // Arrange $entry = Entry::factory()->create(); // Act & Assert actAsTab(); get(route('entry-flags.confirmNoShow', ['entry_id' => $entry->id])) ->assertOk() ->assertFormExists('#no-show-confirmation-form', function (AssertForm $form) use ($entry) { $form->hasMethod('POST') ->hasAction(route('entry-flags.enterNoShow', ['entry' => $entry->id])) ->contains('button', ['type' => 'submit']) ->hasCSRF(); }); }); it('posts to entry-flags.undoNoShow and has a remove button if the entry is already a noshow', function () { // Arrange $entry = Entry::factory()->create(); $entry->addFlag('no_show'); // Act & Assert actAsTab(); get(route('entry-flags.confirmNoShow', ['entry_id' => $entry->id])) ->assertOk() ->assertFormExists('#no-show-cancellation-form', function (AssertForm $form) use ($entry) { $form->hasMethod('POST') ->hasAction(route('entry-flags.undoNoShow', ['entry' => $entry->id])) ->contains('button', ['type' => 'submit']) ->hasCSRF(); }); });