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:
authorAhmad Sherif <me@ahmadsherif.com>2016-10-11 15:25:17 +0300
committerAhmad Sherif <me@ahmadsherif.com>2016-11-18 21:25:45 +0300
commitfd05e26618dd0c123ca476b6f5a3d85f1cfe397a (patch)
tree39a4ac60382ca7ce8d46e3745ba8a381580d6314 /spec/models/project_group_link_spec.rb
parentaea8baed3093c513560e9ac5ac0c5c99508d3001 (diff)
Precalculate user's authorized projects in database
Closes #23150
Diffstat (limited to 'spec/models/project_group_link_spec.rb')
-rw-r--r--spec/models/project_group_link_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/project_group_link_spec.rb b/spec/models/project_group_link_spec.rb
index c5ff1941378..47397a822c1 100644
--- a/spec/models/project_group_link_spec.rb
+++ b/spec/models/project_group_link_spec.rb
@@ -14,4 +14,20 @@ describe ProjectGroupLink do
it { should validate_presence_of(:group) }
it { should validate_presence_of(:group_access) }
end
+
+ describe "destroying a record", truncate: true do
+ it "refreshes group users' authorized projects" do
+ project = create(:project, :private)
+ group = create(:group)
+ reporter = create(:user)
+ group_users = group.users
+
+ group.add_reporter(reporter)
+ project.project_group_links.create(group: group)
+ group_users.each { |user| expect(user.authorized_projects).to include(project) }
+
+ project.project_group_links.destroy_all
+ group_users.each { |user| expect(user.authorized_projects).not_to include(project) }
+ end
+ end
end