2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
require 'fast_spec_helper'
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::Ci::Build::Port do
|
2019-07-07 11:18:12 +05:30
|
|
|
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
|