summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2017-12-01 11:15:16 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2017-12-01 11:15:16 +0000
commit4ebc674a03597de16e09930850f32aee5c1d6ecf (patch)
tree9f5b9d92979067e8e58b9811d12e38705e962fed /spec/models
parent3e78b5ae8f99b18e05e4d35068cbc0785178ba4b (diff)
parent70194cfc28009f419f74580cf199fe91aa1754ec (diff)
downloadgitlab-ce-4ebc674a03597de16e09930850f32aee5c1d6ecf.tar.gz
Merge branch 'add_project_ci_config_path_leading_slash_validation' into 'master'
Adds validation for Project#ci_config_path not to contain leading slash Closes #34683 See merge request gitlab-org/gitlab-ce!15672
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/project_spec.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index a4abcc49a0d..521b7bd70ba 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -138,6 +138,7 @@ describe Project do
it { is_expected.to validate_length_of(:ci_config_path).is_at_most(255) }
it { is_expected.to allow_value('').for(:ci_config_path) }
it { is_expected.not_to allow_value('test/../foo').for(:ci_config_path) }
+ it { is_expected.not_to allow_value('/test/foo').for(:ci_config_path) }
it { is_expected.to validate_presence_of(:creator) }
@@ -1548,8 +1549,8 @@ describe Project do
expect(project.ci_config_path).to eq('foo/.gitlab_ci.yml')
end
- it 'sets a string but removes all leading slashes and null characters' do
- project.update!(ci_config_path: "///f\0oo/\0/.gitlab_ci.yml")
+ it 'sets a string but removes all null characters' do
+ project.update!(ci_config_path: "f\0oo/\0/.gitlab_ci.yml")
expect(project.ci_config_path).to eq('foo//.gitlab_ci.yml')
end