Skip to content

Commit

Permalink
Test redirection after creating a post
Browse files Browse the repository at this point in the history
  • Loading branch information
unclexo committed Dec 14, 2022
1 parent cc24203 commit 01ea641
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Feature/PostModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ public function a_user_can_create_a_post()
$this->assertDatabaseHas('posts', $attributes);
}

/** @test */
public function a_user_can_create_a_post_2()
{
$this->actingAs($user = User::factory()->create());

$this->get(route('posts.create'))->assertStatus(200);

$this->followingRedirects()
->post(route('posts.store'), $attributes = Post::factory()->raw(['user_id' => $user->id]))
->assertSee($attributes['title'])
->assertSee($attributes['description']);
}

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

0 comments on commit 01ea641

Please sign in to comment.