diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-27 16:24:43 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-27 16:24:43 +0100 |
commit | 3761a0c50ea13b86152417a5e659b30879cb16b1 (patch) | |
tree | a80d04879630f85a4648614c9ea5af764b253167 | |
parent | 86e7f22b6d10b9113c52f79685edb332d202f567 (diff) | |
download | gitlab-ce-3761a0c50ea13b86152417a5e659b30879cb16b1.tar.gz |
Extend pipelines factory with transient config attributefix/create-pipeline-with-builds-in-transaction
-rw-r--r-- | spec/factories/ci/pipelines.rb | 21 | ||||
-rw-r--r-- | spec/services/ci/process_pipeline_service_spec.rb | 2 |
2 files changed, 9 insertions, 14 deletions
diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb index 23585db6ebd..1735791f644 100644 --- a/spec/factories/ci/pipelines.rb +++ b/spec/factories/ci/pipelines.rb @@ -21,21 +21,16 @@ FactoryGirl.define do end factory :ci_pipeline do - after(:build) do |pipeline| - allow(pipeline).to receive(:ci_yaml_file) do - File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) - end - end - end - - factory(:ci_pipeline_with_yaml) do - transient { yaml nil } + transient { config nil } after(:build) do |pipeline, evaluator| - raise ArgumentError unless evaluator.yaml - - allow(pipeline).to receive(:ci_yaml_file) - .and_return(YAML.dump(evaluator.yaml)) + allow(pipeline).to receive(:ci_yaml_file) do + if evaluator.config + YAML.dump(evaluator.config) + else + File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) + end + end end end end diff --git a/spec/services/ci/process_pipeline_service_spec.rb b/spec/services/ci/process_pipeline_service_spec.rb index 306943a5488..ebb11166964 100644 --- a/spec/services/ci/process_pipeline_service_spec.rb +++ b/spec/services/ci/process_pipeline_service_spec.rb @@ -295,7 +295,7 @@ describe Ci::ProcessPipelineService, services: true do context 'when there are builds that are not created yet' do let(:pipeline) do - create(:ci_pipeline_with_yaml, yaml: config) + create(:ci_pipeline, config: config) end let(:config) do |