Extend pipelines factory with transient config attribute
This commit is contained in:
parent
86e7f22b6d
commit
3761a0c50e
|
@ -21,21 +21,16 @@ FactoryGirl.define do
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :ci_pipeline do
|
factory :ci_pipeline do
|
||||||
after(:build) do |pipeline|
|
transient { config nil }
|
||||||
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 }
|
|
||||||
|
|
||||||
after(:build) do |pipeline, evaluator|
|
after(:build) do |pipeline, evaluator|
|
||||||
raise ArgumentError unless evaluator.yaml
|
allow(pipeline).to receive(:ci_yaml_file) do
|
||||||
|
if evaluator.config
|
||||||
allow(pipeline).to receive(:ci_yaml_file)
|
YAML.dump(evaluator.config)
|
||||||
.and_return(YAML.dump(evaluator.yaml))
|
else
|
||||||
|
File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
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
|
context 'when there are builds that are not created yet' do
|
||||||
let(:pipeline) do
|
let(:pipeline) do
|
||||||
create(:ci_pipeline_with_yaml, yaml: config)
|
create(:ci_pipeline, config: config)
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:config) do
|
let(:config) do
|
||||||
|
|
Loading…
Reference in New Issue