38 lines
886 B
PHP
38 lines
886 B
PHP
<?php
|
|
|
|
use App\Models\Audition;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
use function Pest\Laravel\get;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
$this->audition = Audition::factory()->create();
|
|
$this->r = route('seating.audition', $this->audition);
|
|
});
|
|
|
|
it('denies access to a guest', function () {
|
|
get($this->r)
|
|
->assertRedirect(route('home'));
|
|
});
|
|
|
|
it('denies access to a normal user', function () {
|
|
actAsNormal();
|
|
get($this->r)
|
|
->assertRedirect(route('dashboard'))
|
|
->assertSessionHas('error', 'You are not authorized to perform this action');
|
|
});
|
|
it('grants access to admin', function () {
|
|
// Arrange
|
|
actAsAdmin();
|
|
// Act & Assert
|
|
get($this->r)->assertOk();
|
|
});
|
|
it('grants access to tabulators', function () {
|
|
// Arrange
|
|
actAsTab();
|
|
// Act & Assert
|
|
get($this->r)->assertOk();
|
|
});
|