Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fccf699e
Commit
fccf699e
authored
Oct 23, 2020
by
sfang97
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add changelog entry
Remove uneeded test Remove feature enabled from spec name Fix changelog typo
parent
24a6292e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
104 deletions
+85
-104
changelogs/unreleased/258980-feature-flag-rollout-of-admin-approval-for-new-user-signups.yml
...e-flag-rollout-of-admin-approval-for-new-user-signups.yml
+5
-0
spec/controllers/admin/users_controller_spec.rb
spec/controllers/admin/users_controller_spec.rb
+17
-19
spec/controllers/registrations_controller_spec.rb
spec/controllers/registrations_controller_spec.rb
+51
-69
spec/features/admin/admin_settings_spec.rb
spec/features/admin/admin_settings_spec.rb
+7
-9
spec/features/admin/admin_users_spec.rb
spec/features/admin/admin_users_spec.rb
+5
-7
No files found.
changelogs/unreleased/258980-feature-flag-rollout-of-admin-approval-for-new-user-signups.yml
0 → 100644
View file @
fccf699e
---
title
:
Remove admin_approval_for_new_user_signups feature flag
merge_request
:
46051
author
:
type
:
changed
spec/controllers/admin/users_controller_spec.rb
View file @
fccf699e
...
...
@@ -107,33 +107,31 @@ RSpec.describe Admin::UsersController do
subject
{
put
:approve
,
params:
{
id:
user
.
username
}
}
context
'when feature is enabled'
do
context
'when successful'
do
it
'activates the user'
do
subject
context
'when successful'
do
it
'activates the user'
do
subject
user
.
reload
user
.
reload
expect
(
user
).
to
be_active
expect
(
flash
[
:notice
]).
to
eq
(
'Successfully approved'
)
end
expect
(
user
).
to
be_active
expect
(
flash
[
:notice
]).
to
eq
(
'Successfully approved'
)
end
end
context
'when unsuccessful'
do
let
(
:user
)
{
create
(
:user
,
:blocked
)
}
context
'when unsuccessful'
do
let
(
:user
)
{
create
(
:user
,
:blocked
)
}
it
'displays the error'
do
subject
it
'displays the error'
do
subject
expect
(
flash
[
:alert
]).
to
eq
(
'The user you are trying to approve is not pending an approval'
)
end
expect
(
flash
[
:alert
]).
to
eq
(
'The user you are trying to approve is not pending an approval'
)
end
it
'does not activate the user'
do
subject
it
'does not activate the user'
do
subject
user
.
reload
expect
(
user
).
not_to
be_active
end
user
.
reload
expect
(
user
).
not_to
be_active
end
end
end
...
...
spec/controllers/registrations_controller_spec.rb
View file @
fccf699e
...
...
@@ -46,94 +46,76 @@ RSpec.describe RegistrationsController do
subject
{
post
(
:create
,
params:
user_params
)
}
context
'`blocked_pending_approval` state'
do
context
'when the feature is enabled'
do
context
'when the `require_admin_approval_after_user_signup` setting is turned on'
do
before
do
stub_application_setting
(
require_admin_approval_after_user_signup:
true
)
end
context
'when the `require_admin_approval_after_user_signup` setting is turned on'
do
before
do
stub_application_setting
(
require_admin_approval_after_user_signup:
true
)
end
it
'signs up the user in `blocked_pending_approval` state'
do
subject
created_user
=
User
.
find_by
(
email:
'new@user.com'
)
it
'signs up the user in `blocked_pending_approval` state'
do
subject
created_user
=
User
.
find_by
(
email:
'new@user.com'
)
expect
(
created_user
).
to
be_present
expect
(
created_user
.
blocked_pending_approval?
).
to
eq
(
true
)
end
expect
(
created_user
).
to
be_present
expect
(
created_user
.
blocked_pending_approval?
).
to
eq
(
true
)
end
it
'does not log in the user after sign up'
do
subject
it
'does not log in the user after sign up'
do
subject
expect
(
controller
.
current_user
).
to
be_nil
end
expect
(
controller
.
current_user
).
to
be_nil
end
it
'shows flash message after signing up'
do
subject
it
'shows flash message after signing up'
do
subject
expect
(
response
).
to
redirect_to
(
new_user_session_path
(
anchor:
'login-pane'
))
expect
(
flash
[
:notice
])
.
to
eq
(
'You have signed up successfully. However, we could not sign you in because your account is awaiting approval from your GitLab administrator.'
)
end
expect
(
response
).
to
redirect_to
(
new_user_session_path
(
anchor:
'login-pane'
))
expect
(
flash
[
:notice
])
.
to
eq
(
'You have signed up successfully. However, we could not sign you in because your account is awaiting approval from your GitLab administrator.'
)
end
context
'email confirmation'
do
context
'when `send_user_confirmation_email` is true'
do
before
do
stub_application_setting
(
send_user_confirmation_email:
true
)
end
context
'email confirmation'
do
context
'when `send_user_confirmation_email` is true'
do
before
do
stub_application_setting
(
send_user_confirmation_email:
true
)
end
it
'does not send a confirmation email'
do
expect
{
subject
}
.
not_to
have_enqueued_mail
(
DeviseMailer
,
:confirmation_instructions
)
end
it
'does not send a confirmation email'
do
expect
{
subject
}
.
not_to
have_enqueued_mail
(
DeviseMailer
,
:confirmation_instructions
)
end
end
end
end
context
'when the `require_admin_approval_after_user_signup` setting is turned off'
do
before
do
stub_application_setting
(
require_admin_approval_after_user_signup:
false
)
end
it
'signs up the user in `active` state'
do
subject
created_user
=
User
.
find_by
(
email:
'new@user.com'
)
expect
(
created_user
).
to
be_present
expect
(
created_user
.
active?
).
to
eq
(
true
)
end
context
'when the `require_admin_approval_after_user_signup` setting is turned off'
do
before
do
stub_application_setting
(
require_admin_approval_after_user_signup:
false
)
end
it
'does not show any flash message after signing up'
do
subject
it
'signs up the user in `active` state'
do
subject
created_user
=
User
.
find_by
(
email:
'new@user.com'
)
expect
(
flash
[
:notice
]).
to
be_nil
end
expect
(
created_user
).
to
be_present
expect
(
created_user
.
active?
).
to
eq
(
true
)
end
context
'email confirmation'
do
context
'when `send_user_confirmation_email` is true'
do
before
do
stub_application_setting
(
send_user_confirmation_email:
true
)
end
it
'does not show any flash message after signing up'
do
subject
it
'sends a confirmation email'
do
expect
{
subject
}
.
to
have_enqueued_mail
(
DeviseMailer
,
:confirmation_instructions
)
end
end
end
expect
(
flash
[
:notice
]).
to
be_nil
end
end
context
'when the feature is disabled'
do
context
'when the `require_admin_approval_after_user_signup` setting is turned on'
do
before
do
stub_application_setting
(
require_admin_approval_after_user_signup:
true
)
end
it
'signs up the user in `active` state'
do
subject
context
'email confirmation'
do
context
'when `send_user_confirmation_email` is true'
do
before
do
stub_application_setting
(
send_user_confirmation_email:
true
)
end
created_user
=
User
.
find_by
(
email:
'new@user.com'
)
expect
(
created_user
).
to
be_present
expect
(
created_user
.
active?
).
to
eq
(
true
)
it
'sends a confirmation email'
do
expect
{
subject
}
.
to
have_enqueued_mail
(
DeviseMailer
,
:confirmation_instructions
)
end
end
end
end
...
...
spec/features/admin/admin_settings_spec.rb
View file @
fccf699e
...
...
@@ -132,16 +132,14 @@ RSpec.describe 'Admin updates settings', :clean_gitlab_redis_shared_state, :do_n
context
'Change Sign-up restrictions'
do
context
'Require Admin approval for new signup setting'
do
context
'when feature is enabled'
do
it
'changes the setting'
do
page
.
within
(
'.as-signup'
)
do
check
'Require admin approval for new sign-ups'
click_button
'Save changes'
end
expect
(
current_settings
.
require_admin_approval_after_user_signup
).
to
be_truthy
expect
(
page
).
to
have_content
"Application settings saved successfully"
it
'changes the setting'
do
page
.
within
(
'.as-signup'
)
do
check
'Require admin approval for new sign-ups'
click_button
'Save changes'
end
expect
(
current_settings
.
require_admin_approval_after_user_signup
).
to
be_truthy
expect
(
page
).
to
have_content
"Application settings saved successfully"
end
end
end
...
...
spec/features/admin/admin_users_spec.rb
View file @
fccf699e
...
...
@@ -75,14 +75,12 @@ RSpec.describe "Admin::Users" do
end
context
'`Pending approval` tab'
do
context
'feature is enabled'
do
before
do
visit
admin_users_path
end
before
do
visit
admin_users_path
end
it
'shows the `Pending approval` tab'
do
expect
(
page
).
to
have_link
(
'Pending approval'
,
href:
admin_users_path
(
filter:
'blocked_pending_approval'
))
end
it
'shows the `Pending approval` tab'
do
expect
(
page
).
to
have_link
(
'Pending approval'
,
href:
admin_users_path
(
filter:
'blocked_pending_approval'
))
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment