Create feature tests for earnings and spendings
ADD
tests/Feature/EarningTest.php
+<?php
+
+namespace Tests\Feature;
+
+use App\Earning;
+use App\Space;
+use App\User;
+use Tests\TestCase;
+use Illuminate\Foundation\Testing\WithFaker;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+
+class EarningTest extends TestCase {
+ public function testUnauthorizedUserCantDeleteEarning() {
+ $user = factory(User::class)->create();
+
+ $space = factory(Space::class)->create();
+
+ $earning = factory(Earning::class)->create([
+ 'space_id' => $space->id
+ ]);
+
+ $this->actingAs($user);
+
+ $response = $this->delete('/earnings/' . $earning->id);
+
+ $response->assertStatus(403);
+ }
+}

ADD
tests/Feature/SpendingTest.php
+<?php
+
+namespace Tests\Feature;
+
+use App\Space;
+use App\Spending;
+use App\User;
+use Tests\TestCase;
+use Illuminate\Foundation\Testing\WithFaker;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+
+class SpendingTest extends TestCase {
+ public function testUnauthorizedUserCantDeleteSpending() {
+ $user = factory(User::class)->create();
+
+ $space = factory(Space::class)->create();
+
+ $spending = factory(Spending::class)->create([
+ 'space_id' => $space->id
+ ]);
+
+ $this->actingAs($user);
+
+ $response = $this->delete('/spendings/' . $spending->id);
+
+ $response->assertStatus(403);
+ }
+}

Create feature tests for earnings and spendings