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-06-15 18:08:20 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-15 18:08:20 +0300
commit4774fa00b74a9248b2d14fc424a8c2f1abb0a0de (patch)
tree1fe6da0110394a038cdd0c7ddb2b7bd2c528ff01 /spec/lib/gitlab/config
parent67441623767b3084d594288408bb078b2eb9f83e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/config')
-rw-r--r--spec/lib/gitlab/config/loader/yaml_spec.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/lib/gitlab/config/loader/yaml_spec.rb b/spec/lib/gitlab/config/loader/yaml_spec.rb
index a52c1c362e1..623fe927233 100644
--- a/spec/lib/gitlab/config/loader/yaml_spec.rb
+++ b/spec/lib/gitlab/config/loader/yaml_spec.rb
@@ -5,6 +5,16 @@ require 'spec_helper'
describe Gitlab::Config::Loader::Yaml do
let(:loader) { described_class.new(yml) }
+ let(:yml) do
+ <<~YAML
+ image: 'ruby:2.7'
+ texts:
+ nested_key: 'value1'
+ more_text:
+ more_nested_key: 'value2'
+ YAML
+ end
+
context 'when yaml syntax is correct' do
let(:yml) { 'image: ruby:2.7' }
@@ -61,6 +71,15 @@ describe Gitlab::Config::Loader::Yaml do
expect(loader).not_to be_valid
end
end
+
+ describe '#load_raw!' do
+ it 'raises error' do
+ expect { loader.load_raw! }.to raise_error(
+ Gitlab::Config::Loader::FormatError,
+ 'Invalid configuration format'
+ )
+ end
+ end
end
# Prevent Billion Laughs attack: https://gitlab.com/gitlab-org/gitlab-foss/issues/56018
@@ -123,4 +142,32 @@ describe Gitlab::Config::Loader::Yaml do
end
end
end
+
+ describe '#load_raw!' do
+ it 'loads keys as strings' do
+ expect(loader.load_raw!).to eq(
+ 'image' => 'ruby:2.7',
+ 'texts' => {
+ 'nested_key' => 'value1',
+ 'more_text' => {
+ 'more_nested_key' => 'value2'
+ }
+ }
+ )
+ end
+ end
+
+ describe '#load!' do
+ it 'symbolizes keys' do
+ expect(loader.load!).to eq(
+ image: 'ruby:2.7',
+ texts: {
+ nested_key: 'value1',
+ more_text: {
+ more_nested_key: 'value2'
+ }
+ }
+ )
+ end
+ end
end