summaryrefslogtreecommitdiff
path: root/spec/helpers/blob_helper_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 01:45:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 01:45:44 +0000
commit85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch)
tree9160f299afd8c80c038f08e1545be119f5e3f1e1 /spec/helpers/blob_helper_spec.rb
parent15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff)
downloadgitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'spec/helpers/blob_helper_spec.rb')
-rw-r--r--spec/helpers/blob_helper_spec.rb55
1 files changed, 55 insertions, 0 deletions
diff --git a/spec/helpers/blob_helper_spec.rb b/spec/helpers/blob_helper_spec.rb
index 3ba9f39d21a..06f86e7716a 100644
--- a/spec/helpers/blob_helper_spec.rb
+++ b/spec/helpers/blob_helper_spec.rb
@@ -481,4 +481,59 @@ RSpec.describe BlobHelper do
end
end
end
+
+ describe '#editing_ci_config?' do
+ let(:project) { build(:project) }
+
+ subject { helper.editing_ci_config? }
+
+ before do
+ assign(:project, project)
+ assign(:path, path)
+ end
+
+ context 'when path is nil' do
+ let(:path) { nil }
+
+ it { is_expected.to be_falsey }
+ end
+
+ context 'when path is not a ci file' do
+ let(:path) { 'some-file.txt' }
+
+ it { is_expected.to be_falsey }
+ end
+
+ context 'when path ends is gitlab-ci.yml' do
+ let(:path) { '.gitlab-ci.yml' }
+
+ it { is_expected.to be_truthy }
+ end
+
+ context 'when path ends with gitlab-ci.yml' do
+ let(:path) { 'template.gitlab-ci.yml' }
+
+ it { is_expected.to be_truthy }
+ end
+
+ context 'with custom ci paths' do
+ let(:path) { 'path/to/ci.yaml' }
+
+ before do
+ project.ci_config_path = 'path/to/ci.yaml'
+ end
+
+ it { is_expected.to be_truthy }
+ end
+
+ context 'with custom ci config and path' do
+ let(:path) { 'path/to/template.gitlab-ci.yml' }
+
+ before do
+ project.ci_config_path = 'ci/path/.gitlab-ci.yml@another-group/another-project'
+ end
+
+ it { is_expected.to be_truthy }
+ end
+ end
end