Skip to content

Commit

Permalink
fix: fix creating default gender (#5607)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsawo authored Oct 13, 2021
1 parent d209313 commit 6c5ac48
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/Http/Controllers/Settings/GendersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public function store(Request $request)
]
);

if ($request->input('isDefault')) {
$this->updateDefault($gender);
}

return $this->formatData($gender);
}

Expand Down
16 changes: 16 additions & 0 deletions tests/Unit/Controllers/Settings/GendersControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ public function it_stores_a_new_gender()
]);
}

/** @test */
public function it_stores_a_new_default_gender()
{
$user = $this->signin();

$this->assertNull($user->account->default_gender_id);

$response = $this->json('POST', '/settings/personalization/genders', [
'name' => 'new-default-gender',
'type' => 'O',
'isDefault' => 'true',
]);

$this->assertEquals($response->getData()->id, $user->account->default_gender_id);
}

/** @test */
public function it_updates_a_gender()
{
Expand Down

0 comments on commit 6c5ac48

Please sign in to comment.