Commit 1e2e0de9 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Define actions in let so that it could be overridden

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8091/diffs#note_20236356
parent ec003d9e
......@@ -249,7 +249,13 @@ describe Ci::API::Builds do
end
describe 'PATCH /builds/:id/trace.txt' do
let(:build) { create(:ci_build, :pending, :trace, runner_id: runner.id) }
let(:build) do
attributes = {runner_id: runner.id, pipeline: pipeline}
create(:ci_build, :pending, :trace, attributes) do |build|
build.run
end
end
let(:headers) { { Ci::API::Helpers::BUILD_TOKEN_HEADER => build.token, 'Content-Type' => 'text/plain' } }
let(:headers_with_range) { headers.merge({ 'Content-Range' => '11-20' }) }
let(:update_interval) { 10.seconds.to_i }
......@@ -276,7 +282,6 @@ describe Ci::API::Builds do
end
before do
build.run!
initial_patch_the_trace
end
......@@ -332,17 +337,15 @@ describe Ci::API::Builds do
context 'when project for the build has been deleted' do
let(:build) do
result = create(:ci_build,
:pending,
:trace,
runner_id: runner.id,
pipeline: pipeline)
result.project.update(pending_delete: true)
result
attributes = {runner_id: runner.id, pipeline: pipeline}
create(:ci_build, :pending, :trace, attributes) do |build|
build.run
build.project.update(pending_delete: true)
end
end
it 'responds with forbidden' do
expect(response.status).to eq 403
expect(response.status).to eq(403)
end
end
end
......
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