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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-03-23 15:44:12 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-03-23 15:44:12 +0300
commit8a2bc9b4457903dfdb0efc88c5ba816f4ba3141e (patch)
treeb2070a8ecb32449ecdb4a1bf7dc9c40afacee912 /spec/lib/gitlab/ci/variables/collection_spec.rb
parent96d6193cabacc92f43bd441f48d63b226d9dad21 (diff)
Integration variables collections with expressions
Diffstat (limited to 'spec/lib/gitlab/ci/variables/collection_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/variables/collection_spec.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/lib/gitlab/ci/variables/collection_spec.rb b/spec/lib/gitlab/ci/variables/collection_spec.rb
index 90b6e178242..cb2f7718c9c 100644
--- a/spec/lib/gitlab/ci/variables/collection_spec.rb
+++ b/spec/lib/gitlab/ci/variables/collection_spec.rb
@@ -7,7 +7,7 @@ describe Gitlab::Ci::Variables::Collection do
collection = described_class.new([variable])
- expect(collection.first.to_hash).to eq variable
+ expect(collection.first.to_runner_variable).to eq variable
end
it 'can be initialized without an argument' do
@@ -96,4 +96,19 @@ describe Gitlab::Ci::Variables::Collection do
.to eq [{ key: 'TEST', value: 1, public: true }]
end
end
+
+ describe '#to_hash' do
+ it 'returns regular hash in valid order without duplicates' do
+ collection = described_class.new
+ .append(key: 'TEST1', value: 'test-1')
+ .append(key: 'TEST2', value: 'test-2')
+ .append(key: 'TEST1', value: 'test-3')
+
+ expect(collection.to_hash).to eq('TEST1' => 'test-3',
+ 'TEST2' => 'test-2')
+
+ expect(collection.to_hash).to include(TEST1: 'test-3')
+ expect(collection.to_hash).not_to include(TEST1: 'test-1')
+ end
+ end
end