From 120f4aaedc8fe830a3f572491d240d8ee6addefb Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 24 Mar 2020 15:08:44 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../application_settings/general.html.haml_spec.rb | 36 ++++++++++++++++++++++ .../integrations.html.haml_spec.rb | 34 -------------------- 2 files changed, 36 insertions(+), 34 deletions(-) create mode 100644 spec/views/admin/application_settings/general.html.haml_spec.rb delete mode 100644 spec/views/admin/application_settings/integrations.html.haml_spec.rb (limited to 'spec/views/admin/application_settings') diff --git a/spec/views/admin/application_settings/general.html.haml_spec.rb b/spec/views/admin/application_settings/general.html.haml_spec.rb new file mode 100644 index 00000000000..e6a0307afd9 --- /dev/null +++ b/spec/views/admin/application_settings/general.html.haml_spec.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'admin/application_settings/general.html.haml' do + let(:app_settings) { build(:application_setting) } + let(:user) { create(:admin) } + + describe 'sourcegraph integration' do + let(:sourcegraph_flag) { true } + + before do + assign(:application_setting, app_settings) + allow(Gitlab::Sourcegraph).to receive(:feature_available?).and_return(sourcegraph_flag) + allow(view).to receive(:current_user).and_return(user) + end + + context 'when sourcegraph feature is enabled' do + it 'show the form' do + render + + expect(rendered).to have_field('application_setting_sourcegraph_enabled') + end + end + + context 'when sourcegraph feature is disabled' do + let(:sourcegraph_flag) { false } + + it 'show the form' do + render + + expect(rendered).not_to have_field('application_setting_sourcegraph_enabled') + end + end + end +end diff --git a/spec/views/admin/application_settings/integrations.html.haml_spec.rb b/spec/views/admin/application_settings/integrations.html.haml_spec.rb deleted file mode 100644 index 392d43ef2d4..00000000000 --- a/spec/views/admin/application_settings/integrations.html.haml_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe 'admin/application_settings/integrations.html.haml' do - let(:app_settings) { build(:application_setting) } - - describe 'sourcegraph integration' do - let(:sourcegraph_flag) { true } - - before do - assign(:application_setting, app_settings) - allow(Gitlab::Sourcegraph).to receive(:feature_available?).and_return(sourcegraph_flag) - end - - context 'when sourcegraph feature is enabled' do - it 'show the form' do - render - - expect(rendered).to have_field('application_setting_sourcegraph_enabled') - end - end - - context 'when sourcegraph feature is disabled' do - let(:sourcegraph_flag) { false } - - it 'show the form' do - render - - expect(rendered).not_to have_field('application_setting_sourcegraph_enabled') - end - end - end -end -- cgit v1.2.3