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-09-19 04:45:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 04:45:44 +0300
commit85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch)
tree9160f299afd8c80c038f08e1545be119f5e3f1e1 /spec/lib/constraints
parent15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff)
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'spec/lib/constraints')
-rw-r--r--spec/lib/constraints/jira_encoded_url_constrainer_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/lib/constraints/jira_encoded_url_constrainer_spec.rb b/spec/lib/constraints/jira_encoded_url_constrainer_spec.rb
new file mode 100644
index 00000000000..70e649d35da
--- /dev/null
+++ b/spec/lib/constraints/jira_encoded_url_constrainer_spec.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Constraints::JiraEncodedUrlConstrainer do
+ let(:namespace_id) { 'group' }
+ let(:project_id) { 'project' }
+ let(:path) { "/#{namespace_id}/#{project_id}" }
+ let(:request) { double(:request, path: path, params: { namespace_id: namespace_id, project_id: project_id }) }
+
+ describe '#matches?' do
+ subject { described_class.new.matches?(request) }
+
+ context 'when there is no /-/jira prefix and no encoded slash' do
+ it { is_expected.to eq(false) }
+ end
+
+ context 'when tree path contains encoded slash' do
+ let(:path) { "/#{namespace_id}/#{project_id}/tree/folder-with-#{Gitlab::Jira::Dvcs::ENCODED_SLASH}" }
+
+ it { is_expected.to eq(false) }
+ end
+
+ context 'when path has /-/jira prefix' do
+ let(:path) { "/-/jira/#{namespace_id}/#{project_id}" }
+
+ it { is_expected.to eq(true) }
+ end
+
+ context 'when project_id has encoded slash' do
+ let(:project_id) { "sub_group#{Gitlab::Jira::Dvcs::ENCODED_SLASH}sub_project" }
+
+ it { is_expected.to eq(true) }
+ end
+ end
+end