Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-18 21:06:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-18 21:06:21 +0300
commit6d59e989185a7d2645792b713d1b5d95d46651fd (patch)
treef89d869a6c557a3e6e0b9305290259ab1d6fb589 /spec/controllers/profiles
parent5c521d1f9b1e389e2f9b2b5fccf3798159a10f8d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/profiles')
-rw-r--r--spec/controllers/profiles/notifications_controller_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/controllers/profiles/notifications_controller_spec.rb b/spec/controllers/profiles/notifications_controller_spec.rb
index f69847119d4..dbc408bcdd9 100644
--- a/spec/controllers/profiles/notifications_controller_spec.rb
+++ b/spec/controllers/profiles/notifications_controller_spec.rb
@@ -20,6 +20,38 @@ describe Profiles::NotificationsController do
expect(response).to render_template :show
end
+
+ context 'with groups that do not have notification preferences' do
+ set(:group) { create(:group) }
+ set(:subgroup) { create(:group, parent: group) }
+
+ before do
+ group.add_developer(user)
+ end
+
+ it 'still shows up in the list' do
+ sign_in(user)
+
+ get :show
+
+ expect(assigns(:group_notifications).map(&:source_id)).to include(subgroup.id)
+ end
+
+ it 'has an N+1 (but should not)' do
+ sign_in(user)
+
+ control = ActiveRecord::QueryRecorder.new do
+ get :show
+ end
+
+ create_list(:group, 2, parent: group)
+
+ # We currently have an N + 1, switch to `not_to` once fixed
+ expect do
+ get :show
+ end.to exceed_query_limit(control)
+ end
+ end
end
describe 'POST update' do