diff options
Diffstat (limited to 'spec/requests/api/remote_mirrors_spec.rb')
-rw-r--r-- | spec/requests/api/remote_mirrors_spec.rb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/requests/api/remote_mirrors_spec.rb b/spec/requests/api/remote_mirrors_spec.rb index 2186fe375ac..5b5188e024c 100644 --- a/spec/requests/api/remote_mirrors_spec.rb +++ b/spec/requests/api/remote_mirrors_spec.rb @@ -91,6 +91,10 @@ describe API::RemoteMirrors do let(:route) { ->(id) { "/projects/#{project.id}/remote_mirrors/#{id}" } } let(:mirror) { project.remote_mirrors.first } + before do + stub_feature_flags(keep_divergent_refs: false) + end + it 'requires `admin_remote_mirror` permission' do put api(route[mirror.id], developer) @@ -102,12 +106,31 @@ describe API::RemoteMirrors do put api(route[mirror.id], user), params: { enabled: '0', - only_protected_branches: 'true' + only_protected_branches: 'true', + keep_divergent_refs: 'true' } expect(response).to have_gitlab_http_status(:success) expect(json_response['enabled']).to eq(false) expect(json_response['only_protected_branches']).to eq(true) + + # Deleted due to lack of feature availability + expect(json_response['keep_divergent_refs']).to be_nil + end + + context 'with the `keep_divergent_refs` feature enabled' do + before do + stub_feature_flags(keep_divergent_refs: { enabled: true, project: project }) + end + + it 'updates the `keep_divergent_refs` attribute' do + project.add_maintainer(user) + + put api(route[mirror.id], user), params: { keep_divergent_refs: 'true' } + + expect(response).to have_gitlab_http_status(:success) + expect(json_response['keep_divergent_refs']).to eq(true) + end end # TODO: Remove flag: https://gitlab.com/gitlab-org/gitlab/issues/38121 |