diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml index 16ad8ebc65675fa04743e52b24e35e8135b4eeaa..40e76468a243d7129c9d4e598ea2f4a7b9a7540a 100644 --- a/app/views/shared/_clone_panel.html.haml +++ b/app/views/shared/_clone_panel.html.haml @@ -24,6 +24,6 @@ .input-group-append = clipboard_button(target: '#project_clone', title: _("Copy URL to clipboard"), class: "input-group-text btn-default btn-clipboard") - = geo_button(modal_target: '#modal-geo-info') + = geo_button(modal_target: '#modal-geo-info') if Gitlab::Geo.secondary? = render 'shared/geo_info_modal', project: project if Gitlab::Geo.secondary? diff --git a/ee/changelogs/unreleased/10398-geo-clone-button-should-check-for-geo.yml b/ee/changelogs/unreleased/10398-geo-clone-button-should-check-for-geo.yml new file mode 100644 index 0000000000000000000000000000000000000000..f67b8d6f217ee1fd8793b9528f604d7fee822c16 --- /dev/null +++ b/ee/changelogs/unreleased/10398-geo-clone-button-should-check-for-geo.yml @@ -0,0 +1,6 @@ +--- +title: 'Geo: Only display Geo-specific clone instructions button on a Geo Secondary + node' +merge_request: 10007 +author: +type: fixed diff --git a/spec/views/shared/_clone_panel.html.haml_spec.rb b/spec/views/shared/_clone_panel.html.haml_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..28f8fb70edbd67e6f012544c0837a745cb6b4703 --- /dev/null +++ b/spec/views/shared/_clone_panel.html.haml_spec.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'shared/_clone_panel' do + include EE::GeoHelpers + + set(:primary) { create(:geo_node, :primary) } + set(:secondary) { create(:geo_node) } + set(:project) { create(:project) } + + shared_examples 'has no geo-specific instructions' do + it 'has no geo-specific instructions' do + render 'shared/clone_panel', project: project + + expect(rendered).not_to match /See Geo-specific instructions/ + end + end + + context 'without Geo enabled' do + it_behaves_like 'has no geo-specific instructions' + end + + context 'On a Geo primary node' do + before do + stub_current_geo_node(primary) + end + + it_behaves_like 'has no geo-specific instructions' + end + + context 'On a Geo secondary node' do + before do + stub_current_geo_node(secondary) + end + + it 'renders Geo-specific instructions button' do + render 'shared/clone_panel', project: project + + expect(rendered).to match /See Geo-specific instructions/ + end + end +end