summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2019-01-04 10:35:14 +0000
committerDouwe Maan <douwe@gitlab.com>2019-01-04 10:35:14 +0000
commit147f740730b63dbdd4c457bb3a783510d225d73b (patch)
treedea56648f2a635a875527fb9c9c216c02a707d9c /spec
parent43687c62607075ee201b8ea1e16ac6e6563b45be (diff)
parentba861a22198255bb461596e7fe6ec88248d1a2fe (diff)
downloadgitlab-ce-147f740730b63dbdd4c457bb3a783510d225d73b.tar.gz
Merge branch 'sh-skip-validation-visibility-changed' into 'master'
Only validate project visibility when it has changed Closes #55881 See merge request gitlab-org/gitlab-ce!24142
Diffstat (limited to 'spec')
-rw-r--r--spec/models/project_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 2e95d35e134..2170ef1f155 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -2963,6 +2963,24 @@ describe Project do
end
end
+ describe '#update' do
+ let(:project) { create(:project) }
+
+ it 'validates the visibility' do
+ expect(project).to receive(:visibility_level_allowed_as_fork).and_call_original
+ expect(project).to receive(:visibility_level_allowed_by_group).and_call_original
+
+ project.update(visibility_level: Gitlab::VisibilityLevel::INTERNAL)
+ end
+
+ it 'does not validate the visibility' do
+ expect(project).not_to receive(:visibility_level_allowed_as_fork).and_call_original
+ expect(project).not_to receive(:visibility_level_allowed_by_group).and_call_original
+
+ project.update(updated_at: Time.now)
+ end
+ end
+
describe '#last_repository_updated_at' do
it 'sets to created_at upon creation' do
project = create(:project, created_at: 2.hours.ago)
@@ -3189,6 +3207,13 @@ describe Project do
expect { project.migrate_to_hashed_storage! }.to change { project.repository_read_only }.to(true)
end
+ it 'does not validate project visibility' do
+ expect(project).not_to receive(:visibility_level_allowed_as_fork)
+ expect(project).not_to receive(:visibility_level_allowed_by_group)
+
+ project.migrate_to_hashed_storage!
+ end
+
it 'schedules ProjectMigrateHashedStorageWorker with delayed start when the project repo is in use' do
Gitlab::ReferenceCounter.new(project.gl_repository(is_wiki: false)).increase