summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-10-10 14:00:56 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-10-10 14:00:56 +0200
commit54f490a455dea705908d5e262fb5fe205147fa09 (patch)
treee7e6133efff41ffe2dedd78af7fefc3b13e3769f
parent20fc42e99a5e8c917feaa0c7a2d34aceba4a8eb9 (diff)
downloadgitlab-ce-54f490a455dea705908d5e262fb5fe205147fa09.tar.gz
Add initial specs for pipeline build chain class
-rw-r--r--spec/lib/gitlab/ci/pipeline/chain/build_spec.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/chain/build_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/build_spec.rb
new file mode 100644
index 00000000000..fbb72e6a51a
--- /dev/null
+++ b/spec/lib/gitlab/ci/pipeline/chain/build_spec.rb
@@ -0,0 +1,43 @@
+require 'spec_helper'
+
+describe Gitlab::Ci::Pipeline::Chain::Build do
+ set(:project) { create(:project, :repository) }
+ set(:user) { create(:user) }
+ let(:pipeline) { Ci::Pipeline.new }
+
+ let(:command) do
+ double('command', source: :push,
+ origin_ref: 'master',
+ checkout_sha: project.commit.id,
+ after_sha: nil,
+ before_sha: nil,
+ trigger_request: nil,
+ schedule: nil,
+ project: project,
+ current_user: user)
+ end
+
+ let(:step) { described_class.new(pipeline, command) }
+
+ before do
+ stub_ci_pipeline_to_return_yaml_file
+
+ step.perform!
+ end
+
+ it 'never breaks the chain' do
+ expect(step.break?).to be false
+ end
+
+ it 'fills pipeline object with data' do
+ expect(pipeline.sha).not_to be_empty
+ end
+
+ it 'sets a valid config source' do
+ expect(pipeline.repository_source?).to be true
+ end
+
+ it 'returns a valid pipeline' do
+ expect(pipeline).to be_valid
+ end
+end