summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/build/port_spec.rb
diff options
context:
space:
mode:
authorFrancisco Javier López <fjlopez@gitlab.com>2019-04-03 09:50:54 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2019-04-03 09:50:54 +0000
commit6ee1d8cf7778ecef0997c10f22b18ab4b61e9b3b (patch)
treec3c33ae8baff308b7c3334829a804d532658c1b1 /spec/lib/gitlab/ci/build/port_spec.rb
parenta7d3a5e43957185dc6193d1b97c57fc4eb02e9ea (diff)
downloadgitlab-ce-6ee1d8cf7778ecef0997c10f22b18ab4b61e9b3b.tar.gz
Add port section to CI Image object
In order to implement https://gitlab.com/gitlab-org/gitlab-ee/issues/10179 we need several modifications on the CI config file. We are adding a new ports section in the default Image object. Each of these ports will accept: number, protocol and name. By default this new configuration will be only enabled in the Web IDE config file.
Diffstat (limited to 'spec/lib/gitlab/ci/build/port_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/build/port_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/build/port_spec.rb b/spec/lib/gitlab/ci/build/port_spec.rb
new file mode 100644
index 00000000000..1413780dfa6
--- /dev/null
+++ b/spec/lib/gitlab/ci/build/port_spec.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Gitlab::Ci::Build::Port do
+ subject { described_class.new(port) }
+
+ context 'when port is defined as an integer' do
+ let(:port) { 80 }
+
+ it 'populates the object' do
+ expect(subject.number).to eq 80
+ expect(subject.protocol).to eq described_class::DEFAULT_PORT_PROTOCOL
+ expect(subject.name).to eq described_class::DEFAULT_PORT_NAME
+ end
+ end
+
+ context 'when port is defined as hash' do
+ let(:port) { { number: 80, protocol: 'https', name: 'port_name' } }
+
+ it 'populates the object' do
+ expect(subject.number).to eq 80
+ expect(subject.protocol).to eq 'https'
+ expect(subject.name).to eq 'port_name'
+ end
+ end
+end