Commit 559a85ec authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix test failures

parent b27f9848
require 'spec_helper'
describe API::Jobs, :api do
let!(:project) do
let(:project) do
create(:project, :repository, public_builds: false)
end
let!(:pipeline) do
let(:pipeline) do
create(:ci_empty_pipeline, project: project,
sha: project.commit.id,
ref: project.default_branch)
end
let!(:build) { create(:ci_build, pipeline: pipeline) }
let(:build) { create(:ci_build, pipeline: pipeline) }
let(:user) { create(:user) }
let(:api_user) { user }
......@@ -26,6 +26,7 @@ describe API::Jobs, :api do
let(:query) { Hash.new }
before do
build
get api("/projects/#{project.id}/jobs", api_user), query
end
......@@ -89,6 +90,7 @@ describe API::Jobs, :api do
let(:query) { Hash.new }
before do
build
get api("/projects/#{project.id}/pipelines/#{pipeline.id}/jobs", api_user), query
end
......
......@@ -185,7 +185,7 @@ describe API::Runner do
let(:project) { create(:empty_project, shared_runners_enabled: false) }
let(:pipeline) { create(:ci_pipeline_without_jobs, project: project, ref: 'master') }
let(:runner) { create(:ci_runner) }
let!(:job) do
let(:job) do
create(:ci_build, :artifacts, :extended_options,
pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0, commands: "ls\ndate")
end
......@@ -197,7 +197,10 @@ describe API::Runner do
let!(:new_update) { }
let(:user_agent) { 'gitlab-runner 9.0.0 (9-0-stable; go1.7.4; linux/amd64)' }
before { stub_container_registry_config(enabled: false) }
before do
job
stub_container_registry_config(enabled: false)
end
shared_examples 'no jobs available' do
before { request_job }
......@@ -1069,7 +1072,7 @@ describe API::Runner do
{ 'Content-Transfer-Encoding' => 'binary',
'Content-Disposition' => 'attachment; filename=ci_build_artifacts.zip' }
end
it 'download artifacts' do
expect(response).to have_http_status(200)
expect(response.headers).to include download_headers
......@@ -1078,7 +1081,7 @@ describe API::Runner do
context 'when artifacts are stored remotely' do
let(:job) { create(:ci_build, :artifacts, :remote_store) }
it 'download artifacts' do
expect(response).to have_http_status(302)
end
......
......@@ -7,13 +7,14 @@ describe API::V3::Builds do
let!(:developer) { create(:project_member, :developer, user: user, project: project) }
let(:reporter) { create(:project_member, :reporter, project: project) }
let(:guest) { create(:project_member, :guest, project: project) }
let!(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.id, ref: project.default_branch) }
let!(:build) { create(:ci_build, pipeline: pipeline) }
let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.id, ref: project.default_branch) }
let(:build) { create(:ci_build, pipeline: pipeline) }
describe 'GET /projects/:id/builds ' do
let(:query) { '' }
before do
build
create(:ci_build, :skipped, pipeline: pipeline)
get v3_api("/projects/#{project.id}/builds?#{query}", api_user)
......@@ -87,6 +88,10 @@ describe API::V3::Builds do
end
describe 'GET /projects/:id/repository/commits/:sha/builds' do
before do
build
end
context 'when commit does not exist in repository' do
before do
get v3_api("/projects/#{project.id}/repository/commits/1a271fd1/builds", api_user)
......
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