Commit 8af3b4e0 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Only display Geo button when in a Geo secondary node

This shared view is used by the Wiki clone screen and also by GitLab
when in mobile version.
parent 7043297c
......@@ -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?
---
title: 'Geo: Only display Geo-specific clone instructions button on a Geo Secondary
node'
merge_request: 10007
author:
type: fixed
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment