summaryrefslogtreecommitdiff
path: root/spec/requests/users_controller_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 09:40:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 09:40:42 +0000
commitee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch)
treef8479f94a28f66654c6a4f6fb99bad6b4e86a40e /spec/requests/users_controller_spec.rb
parent62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff)
downloadgitlab-ce-ee664acb356f8123f4f6b00b73c1e1cf0866c7fb.tar.gz
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'spec/requests/users_controller_spec.rb')
-rw-r--r--spec/requests/users_controller_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb
index 42f14392117..e78d4cc326e 100644
--- a/spec/requests/users_controller_spec.rb
+++ b/spec/requests/users_controller_spec.rb
@@ -828,6 +828,26 @@ RSpec.describe UsersController do
end
end
+ describe 'POST #follow' do
+ context 'when over followee limit' do
+ before do
+ stub_const('Users::UserFollowUser::MAX_FOLLOWEE_LIMIT', 2)
+ sign_in(user)
+ end
+
+ it 'alerts and not follow' do
+ Users::UserFollowUser::MAX_FOLLOWEE_LIMIT.times { user.follow(create(:user)) }
+
+ post user_follow_url(username: public_user.username)
+ expect(response).to be_redirect
+
+ expected_message = format(_("You can't follow more than %{limit} users. To follow more users, unfollow some others."), limit: Users::UserFollowUser::MAX_FOLLOWEE_LIMIT)
+ expect(flash[:alert]).to eq(expected_message)
+ expect(user).not_to be_following(public_user)
+ end
+ end
+ end
+
context 'token authentication' do
it_behaves_like 'authenticates sessionless user for the request spec', 'show atom', public_resource: true do
let(:url) { user_url(user, format: :atom) }