Commit 8275e34e authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

Ci::Build tag is a trait instead of an own factory

Minor annoyance of mine, and there were a couple of things wrong, for
example:
1. Switching on a property is just a trait
2. It didn't inherrit from its parent

Find and replace through the code based fixed all occurances.
parent 2573818f
...@@ -119,7 +119,7 @@ FactoryGirl.define do ...@@ -119,7 +119,7 @@ FactoryGirl.define do
finished_at nil finished_at nil
end end
factory :ci_build_tag do trait :tag do
tag true tag true
end end
......
...@@ -385,7 +385,7 @@ describe API::Runner do ...@@ -385,7 +385,7 @@ describe API::Runner do
end end
context 'when job is made for tag' do context 'when job is made for tag' do
let!(:job) { create(:ci_build_tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) } let!(:job) { create(:ci_build, :tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) }
it 'sets branch as ref_type' do it 'sets branch as ref_type' do
request_job request_job
...@@ -436,8 +436,8 @@ describe API::Runner do ...@@ -436,8 +436,8 @@ describe API::Runner do
end end
context 'when project and pipeline have multiple jobs' do context 'when project and pipeline have multiple jobs' do
let!(:job) { create(:ci_build_tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) } let!(:job) { create(:ci_build, :tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) }
let!(:job2) { create(:ci_build_tag, pipeline: pipeline, name: 'rubocop', stage: 'test', stage_idx: 0) } let!(:job2) { create(:ci_build, :tag, pipeline: pipeline, name: 'rubocop', stage: 'test', stage_idx: 0) }
let!(:test_job) { create(:ci_build, pipeline: pipeline, name: 'deploy', stage: 'deploy', stage_idx: 1) } let!(:test_job) { create(:ci_build, pipeline: pipeline, name: 'deploy', stage: 'deploy', stage_idx: 1) }
before do before do
...@@ -458,7 +458,7 @@ describe API::Runner do ...@@ -458,7 +458,7 @@ describe API::Runner do
end end
context 'when pipeline have jobs with artifacts' do context 'when pipeline have jobs with artifacts' do
let!(:job) { create(:ci_build_tag, :artifacts, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) } let!(:job) { create(:ci_build, :tag, :artifacts, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) }
let!(:test_job) { create(:ci_build, pipeline: pipeline, name: 'deploy', stage: 'deploy', stage_idx: 1) } let!(:test_job) { create(:ci_build, pipeline: pipeline, name: 'deploy', stage: 'deploy', stage_idx: 1) }
before do before do
...@@ -478,8 +478,8 @@ describe API::Runner do ...@@ -478,8 +478,8 @@ describe API::Runner do
end end
context 'when explicit dependencies are defined' do context 'when explicit dependencies are defined' do
let!(:job) { create(:ci_build_tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) } let!(:job) { create(:ci_build, :tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) }
let!(:job2) { create(:ci_build_tag, pipeline: pipeline, name: 'rubocop', stage: 'test', stage_idx: 0) } let!(:job2) { create(:ci_build, :tag, pipeline: pipeline, name: 'rubocop', stage: 'test', stage_idx: 0) }
let!(:test_job) do let!(:test_job) do
create(:ci_build, pipeline: pipeline, token: 'test-job-token', name: 'deploy', create(:ci_build, pipeline: pipeline, token: 'test-job-token', name: 'deploy',
stage: 'deploy', stage_idx: 1, stage: 'deploy', stage_idx: 1,
...@@ -502,8 +502,8 @@ describe API::Runner do ...@@ -502,8 +502,8 @@ describe API::Runner do
end end
context 'when dependencies is an empty array' do context 'when dependencies is an empty array' do
let!(:job) { create(:ci_build_tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) } let!(:job) { create(:ci_build, :tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) }
let!(:job2) { create(:ci_build_tag, pipeline: pipeline, name: 'rubocop', stage: 'test', stage_idx: 0) } let!(:job2) { create(:ci_build, :tag, pipeline: pipeline, name: 'rubocop', stage: 'test', stage_idx: 0) }
let!(:empty_dependencies_job) do let!(:empty_dependencies_job) do
create(:ci_build, pipeline: pipeline, token: 'test-job-token', name: 'empty_dependencies_job', create(:ci_build, pipeline: pipeline, token: 'test-job-token', name: 'empty_dependencies_job',
stage: 'deploy', stage_idx: 1, stage: 'deploy', stage_idx: 1,
......
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