-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
User can delete her own posts, not other authors'
Added steps to fabricate blog with current user as author added step to say I am signed in as user that did not author the post.
- Loading branch information
Showing
3 changed files
with
21 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,38 +2,33 @@ Feature: Authors can delete posts | |
|
||
Scenario: I can delete a post I wrote | ||
Given I am signed in as "[email protected]" | ||
Given the following posts: | ||
| title | body | author_id | | ||
| Foo | Foo Bar | 1 | | ||
Given I have created a blog post with title "foo" and body "bar" | ||
When I go to the homepage | ||
And I click "Delete this post" | ||
Then I should see "Your post has been deleted" | ||
And I should be on the homepage | ||
And I should not see the title "Foo" | ||
And I should not see the title "foo" | ||
And I should not see "Foo Bar" | ||
|
||
|
||
@wip | ||
Scenario: I cannot delete posts if I am not signed in | ||
Given I am not signed in | ||
Given the following posts: | ||
| title | body | author_id | | ||
| Foo | Foo Bar | 1 | | ||
Given the following post: | ||
| title | foo | | ||
| body | Foo Bar | | ||
When I go to the homepage | ||
Then I should not see "Delete this post" | ||
And I should be on the homepage | ||
And I should see the title "Foo" | ||
And I should see the title "foo" | ||
And I should see "Foo Bar" | ||
|
||
@wip | ||
Scenario: I cannot delete posts I didn't write | ||
Given I am signed in as "[email protected]" | ||
Given the following posts: | ||
| title | body | author_id | | ||
| Foo | Foo Bar | 2 | | ||
Given the following post: | ||
| title | foo | | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
maxbeizer
Author
|
||
| body | Foo Bar | | ||
Given I am signed in as a user that did not write the post | ||
When I go to the homepage | ||
Then I should not see "Delete this post" | ||
And I should be on the homepage | ||
And I should see the title "Foo" | ||
And I should see the title "foo" | ||
And I should see "Foo Bar" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For what it's worth- if you've recorded the current user (via @user in the step definitions), you can use fabricate magic to hook up the post for you: