Commit 3761a0c5 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Extend pipelines factory with transient config attribute

parent 86e7f22b
......@@ -21,22 +21,17 @@ FactoryGirl.define do
end
factory :ci_pipeline do
after(:build) do |pipeline|
transient { config nil }
after(:build) do |pipeline, evaluator|
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
factory(:ci_pipeline_with_yaml) do
transient { yaml nil }
after(:build) do |pipeline, evaluator|
raise ArgumentError unless evaluator.yaml
allow(pipeline).to receive(:ci_yaml_file)
.and_return(YAML.dump(evaluator.yaml))
end
end
end
end
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment