2019-03-30 07:23:56 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-12-10 13:25:49 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Ci::Bridge do
|
|
|
|
set(:project) { create(:project) }
|
|
|
|
set(:pipeline) { create(:ci_pipeline, project: project) }
|
|
|
|
|
|
|
|
let(:bridge) do
|
|
|
|
create(:ci_bridge, pipeline: pipeline)
|
|
|
|
end
|
|
|
|
|
2019-04-25 08:23:39 +00:00
|
|
|
it { is_expected.to include_module(Ci::PipelineDelegator) }
|
|
|
|
|
2018-12-10 13:25:49 +00:00
|
|
|
describe '#tags' do
|
|
|
|
it 'only has a bridge tag' do
|
|
|
|
expect(bridge.tags).to eq [:bridge]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#detailed_status' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:status) { bridge.detailed_status(user) }
|
|
|
|
|
|
|
|
it 'returns detailed status object' do
|
2019-07-31 15:36:57 +00:00
|
|
|
expect(status).to be_a Gitlab::Ci::Status::Created
|
2018-12-10 13:25:49 +00:00
|
|
|
end
|
|
|
|
end
|
2019-03-02 14:29:04 +00:00
|
|
|
|
|
|
|
describe '#scoped_variables_hash' do
|
|
|
|
it 'returns a hash representing variables' do
|
2019-03-02 18:21:19 +00:00
|
|
|
variables = %w[
|
|
|
|
CI_JOB_NAME CI_JOB_STAGE CI_COMMIT_SHA CI_COMMIT_SHORT_SHA
|
|
|
|
CI_COMMIT_BEFORE_SHA CI_COMMIT_REF_NAME CI_COMMIT_REF_SLUG
|
2019-03-02 14:29:04 +00:00
|
|
|
CI_PROJECT_ID CI_PROJECT_NAME CI_PROJECT_PATH
|
2019-03-02 18:21:19 +00:00
|
|
|
CI_PROJECT_PATH_SLUG CI_PROJECT_NAMESPACE CI_PIPELINE_IID
|
|
|
|
CI_CONFIG_PATH CI_PIPELINE_SOURCE CI_COMMIT_MESSAGE
|
2019-04-10 10:56:56 +00:00
|
|
|
CI_COMMIT_TITLE CI_COMMIT_DESCRIPTION CI_COMMIT_REF_PROTECTED
|
2019-03-02 14:29:04 +00:00
|
|
|
]
|
2019-03-02 18:21:19 +00:00
|
|
|
|
|
|
|
expect(bridge.scoped_variables_hash.keys).to include(*variables)
|
2019-03-02 14:29:04 +00:00
|
|
|
end
|
|
|
|
end
|
2018-12-10 13:25:49 +00:00
|
|
|
end
|