Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 21:06:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 21:06:24 +0300
commiteca3cd3a9e7d9ea680086cad8150050ec8cdef3f (patch)
treec3d262e0d8e721fc138c2d617f501fb09876f1b6 /spec/views
parent6e81d7f6283fae1b22f66b9d9b133243921cbd9e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/admin/application_settings/integrations.html.haml_spec.rb34
-rw-r--r--spec/views/profiles/preferences/show.html.haml_spec.rb72
-rw-r--r--spec/views/projects/pages_domains/show.html.haml_spec.rb34
3 files changed, 106 insertions, 34 deletions
diff --git a/spec/views/admin/application_settings/integrations.html.haml_spec.rb b/spec/views/admin/application_settings/integrations.html.haml_spec.rb
new file mode 100644
index 00000000000..392d43ef2d4
--- /dev/null
+++ b/spec/views/admin/application_settings/integrations.html.haml_spec.rb
@@ -0,0 +1,34 @@
+# 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
diff --git a/spec/views/profiles/preferences/show.html.haml_spec.rb b/spec/views/profiles/preferences/show.html.haml_spec.rb
new file mode 100644
index 00000000000..52933c42621
--- /dev/null
+++ b/spec/views/profiles/preferences/show.html.haml_spec.rb
@@ -0,0 +1,72 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'profiles/preferences/show' do
+ using RSpec::Parameterized::TableSyntax
+
+ let_it_be(:user) { build(:user) }
+
+ before do
+ assign(:user, user)
+ allow(controller).to receive(:current_user).and_return(user)
+ end
+
+ context 'sourcegraph' do
+ def have_sourcegraph_field(*args)
+ have_field('user_sourcegraph_enabled', *args)
+ end
+
+ def have_integrations_section
+ have_css('.profile-settings-sidebar', { text: 'Integrations' })
+ end
+
+ before do
+ # Can't use stub_feature_flags because we use Feature.get to check if conditinally applied
+ Feature.get(:sourcegraph).enable sourcegraph_feature
+ stub_application_setting(sourcegraph_enabled: sourcegraph_enabled)
+ end
+
+ context 'when not fully enabled' do
+ where(:feature, :admin_enabled) do
+ false | false
+ false | true
+ true | false
+ end
+
+ with_them do
+ let(:sourcegraph_feature) { feature }
+ let(:sourcegraph_enabled) { admin_enabled }
+
+ before do
+ render
+ end
+
+ it 'does not display sourcegraph field' do
+ expect(rendered).not_to have_sourcegraph_field
+ end
+
+ it 'does not display integrations settings' do
+ expect(rendered).not_to have_integrations_section
+ end
+ end
+ end
+
+ context 'when fully enabled' do
+ let(:sourcegraph_feature) { true }
+ let(:sourcegraph_enabled) { true }
+
+ before do
+ render
+ end
+
+ it 'displays the sourcegraph field' do
+ expect(rendered).to have_sourcegraph_field
+ end
+
+ it 'displays the integrations section' do
+ expect(rendered).to have_integrations_section
+ end
+ end
+ end
+end
diff --git a/spec/views/projects/pages_domains/show.html.haml_spec.rb b/spec/views/projects/pages_domains/show.html.haml_spec.rb
index ba0544a49b0..331bfe63f28 100644
--- a/spec/views/projects/pages_domains/show.html.haml_spec.rb
+++ b/spec/views/projects/pages_domains/show.html.haml_spec.rb
@@ -30,39 +30,5 @@ describe 'projects/pages_domains/show' do
expect(rendered).to have_content("GitLab is obtaining a Let's Encrypt SSL certificate for this domain. This process can take some time. Please try again later.")
end
end
-
- context 'when certificate is present' do
- let(:domain) { create(:pages_domain, :letsencrypt, project: project) }
-
- it 'shows certificate info' do
- render
-
- # test just a random part of cert represenations(X509v3 Subject Key Identifier:)
- expect(rendered).to have_content("C6:5F:56:4B:10:69:AC:1D:33:D2:26:C9:B3:7A:D7:12:4D:3E:F7:90")
- end
- end
- end
-
- context 'when auto_ssl is disabled' do
- context 'when certificate is present' do
- let(:domain) { create(:pages_domain, project: project) }
-
- it 'shows certificate info' do
- render
-
- # test just a random part of cert represenations(X509v3 Subject Key Identifier:)
- expect(rendered).to have_content("C6:5F:56:4B:10:69:AC:1D:33:D2:26:C9:B3:7A:D7:12:4D:3E:F7:90")
- end
- end
-
- context 'when certificate is absent' do
- let(:domain) { create(:pages_domain, :without_certificate, :without_key, project: project) }
-
- it 'shows missing certificate' do
- render
-
- expect(rendered).to have_content("missing")
- end
- end
end
end