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>2020-03-13 00:09:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-13 00:09:45 +0300
commitdd4bee69b7d55620f7dc9db8c36b478bd4959755 (patch)
tree78ba4c486ad8aa2d5effaccf23241ffb6c6dde26 /spec/features
parentce8a0b90849ac5d1895e741c023432930f24d724 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/ide/clientside_preview_csp_spec.rb35
-rw-r--r--spec/features/ide/static_object_external_storage_csp_spec.rb2
-rw-r--r--spec/features/projects/sourcegraph_csp_spec.rb2
3 files changed, 37 insertions, 2 deletions
diff --git a/spec/features/ide/clientside_preview_csp_spec.rb b/spec/features/ide/clientside_preview_csp_spec.rb
new file mode 100644
index 00000000000..e097513def3
--- /dev/null
+++ b/spec/features/ide/clientside_preview_csp_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'IDE Clientside Preview CSP' do
+ let_it_be(:user) { create(:user) }
+
+ shared_context 'disable feature' do
+ before do
+ allow_next_instance_of(ApplicationSetting) do |instance|
+ allow(instance).to receive(:web_ide_clientside_preview_enabled?).and_return(false)
+ end
+ end
+ end
+
+ it_behaves_like 'setting CSP', 'frame-src' do
+ let(:whitelisted_url) { 'https://sandbox.gitlab-static.test' }
+ let(:extended_controller_class) { IdeController }
+
+ subject do
+ visit ide_path
+
+ response_headers['Content-Security-Policy']
+ end
+
+ before do
+ allow_next_instance_of(ApplicationSetting) do |instance|
+ allow(instance).to receive(:web_ide_clientside_preview_enabled?).and_return(true)
+ allow(instance).to receive(:web_ide_clientside_preview_bundler_url).and_return(whitelisted_url)
+ end
+
+ sign_in(user)
+ end
+ end
+end
diff --git a/spec/features/ide/static_object_external_storage_csp_spec.rb b/spec/features/ide/static_object_external_storage_csp_spec.rb
index 93c22b35786..739b3fe2471 100644
--- a/spec/features/ide/static_object_external_storage_csp_spec.rb
+++ b/spec/features/ide/static_object_external_storage_csp_spec.rb
@@ -11,7 +11,7 @@ describe 'Static Object External Storage Content Security Policy' do
end
end
- it_behaves_like 'setting CSP connect-src' do
+ it_behaves_like 'setting CSP', 'connect-src' do
let_it_be(:whitelisted_url) { 'https://static-objects.test' }
let_it_be(:extended_controller_class) { IdeController }
diff --git a/spec/features/projects/sourcegraph_csp_spec.rb b/spec/features/projects/sourcegraph_csp_spec.rb
index 385a797368c..f252d3cd027 100644
--- a/spec/features/projects/sourcegraph_csp_spec.rb
+++ b/spec/features/projects/sourcegraph_csp_spec.rb
@@ -12,7 +12,7 @@ describe 'Sourcegraph Content Security Policy' do
end
end
- it_behaves_like 'setting CSP connect-src' do
+ it_behaves_like 'setting CSP', 'connect-src' do
let_it_be(:whitelisted_url) { 'https://sourcegraph.test' }
let_it_be(:extended_controller_class) { Projects::BlobController }