Skip to content

Commit

Permalink
AO3-6713 Update feature test to check that I didn't break a redirect …
Browse files Browse the repository at this point in the history
…when refactoring the create action
  • Loading branch information
sarken committed Apr 15, 2024
1 parent bc6fb91 commit 2e3fad3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 7 additions & 5 deletions features/admins/admin_post_news.feature
Original file line number Diff line number Diff line change
Expand Up @@ -253,25 +253,27 @@ Feature: Admin Actions to Post News

# Leave a guest comment on a moderated admin post
When I log out
And I go to the admin post "Default Admin Post"
And I go to the "Default Admin Post" admin post page
Then I should see "Comments on this news post are moderated. Your comment will not appear until it has been approved."
When I fill in "Comment" with "Perfectly nice comment"
And I fill in "Guest name" with "lovely"
And I fill in "Guest email" with "email@example.com"
And I press "Comment"
Then I should see "Your comment was received! It will appear publicly after it has been approved."
And I should be on the "Default Admin Post" admin post page

# Leave a logged in comment on a moderated admin post
When I am logged in as "commenter"
And I go to the admin post "Default Admin Post"
And I go to the "Default Admin Post" admin post page
Then I should see "Comments on this news post are moderated. Your comment will not appear until it has been approved."
When I fill in "Comment" with "Second perfectly nice comment"
And I press "Comment"
Then I should see "Your comment was received! It will appear publicly after it has been approved."
And I should be on the show page for my latest comment

# Access unreviewed comments
When I am logged in as a "communications" admin
And I go to the admin post "Default Admin Post"
And I go to the "Default Admin Post" admin post page
And I follow "Unreviewed Comments (2)"
Then I should see "Unreviewed Comments on Default Admin Post"
And I should see "Please note that comments cannot be unapproved once you have approved them. After you delete any comments you do not wish to appear on the admin post, you can approve all that remain."
Expand All @@ -280,15 +282,15 @@ Feature: Admin Actions to Post News
When I press "Approve"
Then I should see "Comment approved."
And I should be on the unreviewed comments page for the admin post "Default Admin Post"
When I go to the admin post "Default Admin Post"
When I go to the "Default Admin Post" admin post page
Then I should see "Comments (1)"
And I should see "Unreviewed Comments (1)"

# Approve All Unreviewed Comments
When I go to the unreviewed comments page for the admin post "Default Admin Post"
And I press "Approve All Unreviewed Comments"
Then I should see "All moderated comments approved."
And I should be on the admin post "Default Admin Post"
And I should be on the "Default Admin Post" admin post page
And I should see "Comments (2)"
And I should not see "Unreviewed Comments"

4 changes: 3 additions & 1 deletion features/support/paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def path_to(page_name)
user_invitations_path(User.current_user)
when /my co-creator requests page/
user_creatorships_path(User.current_user)
when /the show page for my latest comment$/
comment_path(User.current_user.comments.last)
when /the gifts page$/
gifts_path
when /the gifts page for the recipient (.*)$/
Expand Down Expand Up @@ -299,7 +301,7 @@ def path_to(page_name)
# Admin Pages
when /^the admin-posts page$/i
admin_posts_path
when /^the admin post "(.*)"$/i
when /^the "(.*)" admin post page$/i
admin_post_path(AdminPost.find_by(title: Regexp.last_match(1)))
when /^the unreviewed comments page for the admin post "(.*)"$/i
unreviewed_admin_post_comments_path(AdminPost.find_by(title: Regexp.last_match(1)))
Expand Down

0 comments on commit 2e3fad3

Please sign in to comment.