diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-05 18:10:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-05 18:10:02 +0300 |
commit | 2c2b5aeac04350b0d3e13d4b52add0b520bf2ebb (patch) | |
tree | 1b006a6d334908dcbdb84d8868ab7cde79a519d7 /spec/services/projects | |
parent | 797182cd82922765fe79a13bc0ed6bd5672d4283 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/projects')
-rw-r--r-- | spec/services/projects/fork_service_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/services/projects/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb index 60dfee820ca..a11f16573f5 100644 --- a/spec/services/projects/fork_service_spec.rb +++ b/spec/services/projects/fork_service_spec.rb @@ -116,6 +116,24 @@ RSpec.describe Projects::ForkService do expect(to_project.fork_network_member.forked_from_project).to eq(from_forked_project) end + context 'when the forked project has higher visibility than the root project' do + let(:root_project) { create(:project, :public) } + + it 'successfully creates a fork of the fork with correct visibility' do + forked_project = fork_project(root_project, @to_user, using_service: true) + + root_project.update!(visibility_level: Gitlab::VisibilityLevel::INTERNAL) + + # Forked project visibility is not affected by root project visibility change + expect(forked_project).to have_attributes(visibility_level: Gitlab::VisibilityLevel::PUBLIC) + + fork_of_the_fork = fork_project(forked_project, @to_user, namespace: other_namespace, using_service: true) + + expect(fork_of_the_fork).to be_valid + expect(fork_of_the_fork).to have_attributes(visibility_level: Gitlab::VisibilityLevel::PUBLIC) + end + end + it_behaves_like 'forks count cache refresh' do let(:from_project) { from_forked_project } let(:to_user) { @to_user } |