diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-07-20 16:25:28 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-07-20 16:25:28 +0800 |
commit | b0f7384f95e94961b6ed91ef0fdddbbe28d77e6e (patch) | |
tree | 20b0df1435cad131ada217496a125f30ddd9097b /spec/requests | |
parent | 02f58dbd6f8d82fdbb728c2cac34a6fba466a14f (diff) | |
download | gitlab-ce-b0f7384f95e94961b6ed91ef0fdddbbe28d77e6e.tar.gz |
Create the pipelines/builds in mixed order, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5347#note_13176921
Also we give undesired builds another artifacts so that we could tell
if returned artifacts was we actual expected.
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/builds_spec.rb | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/spec/requests/api/builds_spec.rb b/spec/requests/api/builds_spec.rb index 351eb6caf98..e19c7a98799 100644 --- a/spec/requests/api/builds_spec.rb +++ b/spec/requests/api/builds_spec.rb @@ -213,6 +213,10 @@ describe API::API, api: true do end context 'find proper build' do + let(:another_artifacts) do + fixture_file_upload(Rails.root + 'spec/fixtures/dk.png', 'image/gif') + end + def verify download_headers = { 'Content-Transfer-Encoding' => 'binary', @@ -223,11 +227,6 @@ describe API::API, api: true do expect(response.headers).to include(download_headers) end - def create_new_pipeline(status) - new_pipeline = create(:ci_pipeline, status: 'success') - create(:ci_build, status, :artifacts, pipeline: new_pipeline) - end - context 'with regular branch' do before do pipeline.update(ref: 'master', @@ -256,8 +255,13 @@ describe API::API, api: true do context 'with latest pipeline' do before do - 3.times do # creating some old pipelines - create_new_pipeline(:success) + pipelines = 3.times.map do # creating some old pipelines + create(:ci_pipeline, status: 'success') + end + + pipelines.reverse_each do |pipe| + new_build = create(:ci_build, :success, pipeline: pipe) + new_build.update(artifacts_file: another_artifacts) end end @@ -271,7 +275,10 @@ describe API::API, api: true do context 'with success pipeline' do before do build # make sure pipeline was old, but still the latest success one - create_new_pipeline(:pending) + new_pipeline = create(:ci_pipeline, status: 'success') + new_build = create(:ci_build, :pending, + pipeline: new_pipeline) + new_build.update(artifacts_file: another_artifacts) end before do |