diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-03 06:08:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-03 06:08:12 +0300 |
commit | 497b73152109b6da922e1a8ffd8ab193f7f3fcd3 (patch) | |
tree | b63d8745c5f549eaa05f9e0ab0cf9609f45b7785 /spec/controllers | |
parent | c8489a149e99123aa1d7425677eb720c31ae7dd8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/profiles/notifications_controller_spec.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/spec/controllers/profiles/notifications_controller_spec.rb b/spec/controllers/profiles/notifications_controller_spec.rb index b320c909cc5..cd6eb929b19 100644 --- a/spec/controllers/profiles/notifications_controller_spec.rb +++ b/spec/controllers/profiles/notifications_controller_spec.rb @@ -54,19 +54,36 @@ RSpec.describe Profiles::NotificationsController do end context 'with group notifications' do + let(:notifications_per_page) { 5 } + let_it_be(:group) { create(:group) } let_it_be(:subgroups) { create_list(:group, 10, parent: group) } before do group.add_developer(user) sign_in(user) - stub_const('Profiles::NotificationsController::NOTIFICATIONS_PER_PAGE', 5) - get :show + stub_const('Profiles::NotificationsController::NOTIFICATIONS_PER_PAGE', notifications_per_page) end it 'paginates the groups' do + get :show + expect(assigns(:group_notifications).count).to eq(5) end + + context 'when the user is not a member' do + let(:notifications_per_page) { 20 } + + let_it_be(:public_group) { create(:group, :public) } + + it 'does not show public groups', :aggregate_failures do + get :show + + # Let's make sure we're grabbing all groups in one page, just in case + expect(assigns(:user_groups).count).to eq(11) + expect(assigns(:user_groups)).not_to include(public_group) + end + end end context 'with project notifications' do |