Skip to content

Commit

Permalink
AO3-4762 added test for controllers/invite_requests_controller (admin…
Browse files Browse the repository at this point in the history
… deleting someone from queue) (#2654)

* AO3-4762 added test for controllers/invite_requests_controller where admin deletes someone from invite queue

* AO3-4762 style & extra confirmation changes

* AO3-4762 fix indentation

* AO3-4762 add space between scenario and rest of steps
  • Loading branch information
niconicosette authored and sarken committed Dec 16, 2016
1 parent b0f8d34 commit 33244a9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
29 changes: 19 additions & 10 deletions features/other_a/invite_queue.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature: Invite queue management
| user1 | password |

Scenario: Can turn queue off in Admin Settings and it displays as off

Given I am logged in as an admin
And I go to the admin-settings page
And I uncheck "admin_setting_invite_from_queue_enabled"
Expand All @@ -21,9 +21,9 @@ Feature: Invite queue management
And I am on the homepage
Then I should not see "Get an Invite"
And I should see "Archive of Our Own"

Scenario: Can turn queue on in Admin Settings and it displays as on

Given I am logged in as an admin
And account creation requires an invitation
And I go to the admin-settings page
Expand All @@ -35,6 +35,15 @@ Feature: Invite queue management
When I follow "Get an Invitation"
Then I should see "Request an Invitation"

Scenario: An admin can delete people from the queue

Given an invitation request for "invitee@example.org"
And I am logged in as an admin
When I go to the manage invite queue page
And I follow "Delete"
Then I should see "Request was removed from the queue."
And I should be on the manage invite queue page

Scenario: Visitors can join the queue and check status when invitations are required and the queue is enabled

# join queue
Expand All @@ -48,27 +57,27 @@ Feature: Invite queue management
When I fill in "invite_request_email" with "test@archiveofourown.org"
And I press "Add me to the list"
Then I should see "You've been added to our queue"

# check your place in the queue - invalid address
When I check how long "testttt@archiveofourown.org" will have to wait in the invite request queue
Then I should see "You can search for the email address you signed up with below."
And I should see "If you can't find it, your invitation may have already been emailed to that address; please check your email Spam folder as your spam filters may have placed it there."
And I should not see "You are currently number"

# check your place in the queue - correct address
When I check how long "test@archiveofourown.org" will have to wait in the invite request queue
Then I should see "Invitation Status for test@archiveofourown.org"
And I should see "You are currently number 1 on our waiting list! At our current rate, you should receive an invitation on or around"

Scenario: Can't add yourself to the queue when queue is off

Given the invitation queue is disabled
When I go to the invite_requests page
Then I should not see "Add yourself to the list"
And I should not see "invite_request_email"

Scenario: Can still check status when queue is off

Given the invitation queue is disabled
And I am logged out as an admin
When I go to the invite_requests page
Expand All @@ -91,7 +100,7 @@ Feature: Invite queue management
When I check how long "test@archiveofourown.org" will have to wait in the invite request queue
Then I should see "You can search for the email address you signed up with below."
And I should see "If you can't find it, your invitation may have already been emailed to that address;"

# invite can be used
When I am logged in as an admin
And I follow "Invitations"
Expand Down Expand Up @@ -120,7 +129,7 @@ Feature: Invite queue management
And the email should contain "Welcome to the Archive of Our Own,"
And the email should contain "newuser"
And the email should contain "activate your account"

# user activates account
When all emails have been delivered
And I click the first link in the email
Expand Down
15 changes: 8 additions & 7 deletions features/support/paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def path_to(page_name)
search_tags_path
when /^the search works page$/i
Work.tire.index.refresh
search_works_path
search_works_path
when /^the search people page$/i
Pseud.tire.index.refresh
search_people_path
Expand Down Expand Up @@ -51,6 +51,8 @@ def path_to(page_name)
new_user_path
when /^invite requests page$/i
invite_requests_path
when /^the manage invite queue page$/i
manage_invite_requests_path
when /my pseuds page/
user_pseuds_path(User.current_user)
when /my user page/
Expand All @@ -66,9 +68,9 @@ def path_to(page_name)
when /my edit multiple works page/
show_multiple_user_works_path(User.current_user)
when /my subscriptions page/
user_subscriptions_path(User.current_user)
user_subscriptions_path(User.current_user)
when /my stats page/
user_stats_path(User.current_user)
user_stats_path(User.current_user)
when /my profile page/
user_profile_path(User.current_user)
when /my claims page/
Expand Down Expand Up @@ -172,7 +174,7 @@ def path_to(page_name)
when /^the admin-posts page$/i
admin_posts_path
when /^the admin-settings page$/i
admin_settings_path
admin_settings_path
when /^the admin-notices page$/i
notify_admin_users_path
when /^the admin-blacklist page$/i
Expand All @@ -192,7 +194,7 @@ def path_to(page_name)
when /^the new tag ?set page$/i
new_tag_set_path
when /^the "(.*)" tag ?set edit page$/i
edit_tag_set_path(OwnedTagSet.find_by_title($1))
edit_tag_set_path(OwnedTagSet.find_by_title($1))
when /^the "(.*)" tag ?set page$/i
tag_set_path(OwnedTagSet.find_by_title($1))
when /^the manage users page$/
Expand All @@ -213,7 +215,7 @@ def path_to(page_name)
tag_wranglings_path
when /^the "(.*)" fandom relationship page$/i
fandom_path($1)

# Here is an example that pulls values out of the Regexp:
#
# when /^(.*)'s profile page$/i
Expand All @@ -233,4 +235,3 @@ def path_to(page_name)
end

World(NavigationHelpers)

0 comments on commit 33244a9

Please sign in to comment.