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>2021-07-23 21:10:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-23 21:10:06 +0300
commit4a6e6c740b131b6291d553fcdab5a0612f8c099b (patch)
treec9b31140b4161e25f5395447272187e344ea9ca1 /spec/experiments
parent228eb2ee910e2fb7f9bedf713c43a30c55cf3314 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/experiments')
-rw-r--r--spec/experiments/application_experiment_spec.rb29
-rw-r--r--spec/experiments/new_project_readme_content_experiment_spec.rb4
2 files changed, 32 insertions, 1 deletions
diff --git a/spec/experiments/application_experiment_spec.rb b/spec/experiments/application_experiment_spec.rb
index 9c03910cf66..4966e508f7e 100644
--- a/spec/experiments/application_experiment_spec.rb
+++ b/spec/experiments/application_experiment_spec.rb
@@ -209,6 +209,35 @@ RSpec.describe ApplicationExperiment, :experiment do
end
end
+ describe "#process_redirect_url" do
+ using RSpec::Parameterized::TableSyntax
+
+ where(:url, :processed_url) do
+ 'https://about.gitlab.com/' | 'https://about.gitlab.com/'
+ 'https://gitlab.com/' | 'https://gitlab.com/'
+ 'http://docs.gitlab.com' | 'http://docs.gitlab.com'
+ 'https://docs.gitlab.com/some/path?foo=bar' | 'https://docs.gitlab.com/some/path?foo=bar'
+ 'http://badgitlab.com' | nil
+ 'https://gitlab.com.nefarious.net' | nil
+ 'https://unknown.gitlab.com' | nil
+ "https://badplace.com\nhttps://gitlab.com" | nil
+ 'https://gitlabbcom' | nil
+ 'https://gitlabbcom/' | nil
+ end
+
+ with_them do
+ it "returns the url or nil if invalid" do
+ allow(Gitlab).to receive(:dev_env_or_com?).and_return(true)
+ expect(subject.process_redirect_url(url)).to eq(processed_url)
+ end
+
+ it "considers all urls invalid when not on dev or com" do
+ allow(Gitlab).to receive(:dev_env_or_com?).and_return(false)
+ expect(subject.process_redirect_url(url)).to be_nil
+ end
+ end
+ end
+
context "when resolving variants" do
it "uses the default value as specified in the yaml" do
expect(Feature).to receive(:enabled?).with('namespaced_stub', subject, type: :experiment, default_enabled: :yaml)
diff --git a/spec/experiments/new_project_readme_content_experiment_spec.rb b/spec/experiments/new_project_readme_content_experiment_spec.rb
index 92a883078df..f76b8a1ded1 100644
--- a/spec/experiments/new_project_readme_content_experiment_spec.rb
+++ b/spec/experiments/new_project_readme_content_experiment_spec.rb
@@ -30,7 +30,9 @@ RSpec.describe NewProjectReadmeContentExperiment, :experiment do
end
it "renders redirect URLs" do
- expect(markdown).to include(Rails.application.routes.url_helpers.experiment_redirect_url(subject, initial_url))
+ expect(markdown).to include(
+ Rails.application.routes.url_helpers.experiment_redirect_url(subject, url: initial_url)
+ )
end
end
end