summaryrefslogtreecommitdiff
path: root/spec/requests/ci/api/builds_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/ci/api/builds_spec.rb')
-rw-r--r--spec/requests/ci/api/builds_spec.rb58
1 files changed, 29 insertions, 29 deletions
diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb
index 7e50bea90d1..1bc51783c3a 100644
--- a/spec/requests/ci/api/builds_spec.rb
+++ b/spec/requests/ci/api/builds_spec.rb
@@ -26,7 +26,7 @@ describe Ci::API::API do
post ci_api("/builds/register"), token: runner.token, info: { platform: :darwin }
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response['sha']).to eq(build.sha)
expect(runner.reload.platform).to eq("darwin")
end
@@ -34,7 +34,7 @@ describe Ci::API::API do
it "should return 404 error if no pending build found" do
post ci_api("/builds/register"), token: runner.token
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
it "should return 404 error if no builds for specific runner" do
@@ -43,7 +43,7 @@ describe Ci::API::API do
post ci_api("/builds/register"), token: runner.token
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
it "should return 404 error if no builds for shared runner" do
@@ -52,7 +52,7 @@ describe Ci::API::API do
post ci_api("/builds/register"), token: shared_runner.token
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
it "returns options" do
@@ -61,7 +61,7 @@ describe Ci::API::API do
post ci_api("/builds/register"), token: runner.token, info: { platform: :darwin }
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response["options"]).to eq({ "image" => "ruby:2.1", "services" => ["postgres"] })
end
@@ -72,7 +72,7 @@ describe Ci::API::API do
post ci_api("/builds/register"), token: runner.token, info: { platform: :darwin }
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response["variables"]).to eq([
{ "key" => "CI_BUILD_NAME", "value" => "spinach", "public" => true },
{ "key" => "CI_BUILD_STAGE", "value" => "test", "public" => true },
@@ -91,7 +91,7 @@ describe Ci::API::API do
post ci_api("/builds/register"), token: runner.token, info: { platform: :darwin }
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response["variables"]).to eq([
{ "key" => "CI_BUILD_NAME", "value" => "spinach", "public" => true },
{ "key" => "CI_BUILD_STAGE", "value" => "test", "public" => true },
@@ -109,7 +109,7 @@ describe Ci::API::API do
post ci_api("/builds/register"), token: runner.token, info: { platform: :darwin }
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response["depends_on_builds"].count).to eq(2)
expect(json_response["depends_on_builds"][0]["name"]).to eq("rspec")
end
@@ -122,7 +122,7 @@ describe Ci::API::API do
it do
post ci_api("/builds/register"), token: runner.token, info: { param => value }
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
runner.reload
is_expected.to eq(value)
end
@@ -172,7 +172,7 @@ describe Ci::API::API do
end
it "should update a running build" do
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
end
it 'should not override trace information when no trace is given' do
@@ -252,13 +252,13 @@ describe Ci::API::API do
context "should authorize posting artifact to running build" do
it "using token as parameter" do
post authorize_url, { token: build.token }, headers
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
expect(json_response["TempPath"]).not_to be_nil
end
it "using token as header" do
post authorize_url, {}, headers_with_token
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
expect(json_response["TempPath"]).not_to be_nil
end
end
@@ -267,13 +267,13 @@ describe Ci::API::API do
it "using token as parameter" do
stub_application_setting(max_artifacts_size: 0)
post authorize_url, { token: build.token, filesize: 100 }, headers
- expect(response.status).to eq(413)
+ expect(response).to have_http_status(413)
end
it "using token as header" do
stub_application_setting(max_artifacts_size: 0)
post authorize_url, { filesize: 100 }, headers_with_token
- expect(response.status).to eq(413)
+ expect(response).to have_http_status(413)
end
end
@@ -281,7 +281,7 @@ describe Ci::API::API do
before { post authorize_url, { token: 'invalid', filesize: 100 } }
it 'should respond with forbidden' do
- expect(response.status).to eq(403)
+ expect(response).to have_http_status(403)
end
end
end
@@ -305,20 +305,20 @@ describe Ci::API::API do
context "should post artifact to running build" do
it "uses regual file post" do
upload_artifacts(file_upload, headers_with_token, false)
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response["artifacts_file"]["filename"]).to eq(file_upload.original_filename)
end
it "uses accelerated file post" do
upload_artifacts(file_upload, headers_with_token, true)
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response["artifacts_file"]["filename"]).to eq(file_upload.original_filename)
end
it "updates artifact" do
upload_artifacts(file_upload, headers_with_token)
upload_artifacts(file_upload2, headers_with_token)
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response["artifacts_file"]["filename"]).to eq(file_upload2.original_filename)
end
end
@@ -343,7 +343,7 @@ describe Ci::API::API do
end
it 'stores artifacts and artifacts metadata' do
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(stored_artifacts_file.original_filename).to eq(artifacts.original_filename)
expect(stored_metadata_file.original_filename).to eq(metadata.original_filename)
end
@@ -355,7 +355,7 @@ describe Ci::API::API do
end
it 'is expected to respond with bad request' do
- expect(response.status).to eq(400)
+ expect(response).to have_http_status(400)
end
it 'does not store metadata' do
@@ -382,7 +382,7 @@ describe Ci::API::API do
it 'updates when specified' do
build.reload
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response['artifacts_expire_at']).not_to be_empty
expect(build.artifacts_expire_at).to be_within(5.minutes).of(Time.now + 7.days)
end
@@ -393,7 +393,7 @@ describe Ci::API::API do
it 'ignores if not specified' do
build.reload
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response['artifacts_expire_at']).to be_nil
expect(build.artifacts_expire_at).to be_nil
end
@@ -404,21 +404,21 @@ describe Ci::API::API do
it "should fail to post too large artifact" do
stub_application_setting(max_artifacts_size: 0)
upload_artifacts(file_upload, headers_with_token)
- expect(response.status).to eq(413)
+ expect(response).to have_http_status(413)
end
end
context "artifacts post request does not contain file" do
it "should fail to post artifacts without file" do
post post_url, {}, headers_with_token
- expect(response.status).to eq(400)
+ expect(response).to have_http_status(400)
end
end
context 'GitLab Workhorse is not configured' do
it "should fail to post artifacts without GitLab-Workhorse" do
post post_url, { token: build.token }, {}
- expect(response.status).to eq(403)
+ expect(response).to have_http_status(403)
end
end
end
@@ -437,7 +437,7 @@ describe Ci::API::API do
it "should fail to post artifacts for outside of tmp path" do
upload_artifacts(file_upload, headers_with_token)
- expect(response.status).to eq(400)
+ expect(response).to have_http_status(400)
end
end
@@ -458,7 +458,7 @@ describe Ci::API::API do
before { delete delete_url, token: build.token }
it 'should remove build artifacts' do
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
expect(build.artifacts_file.exists?).to be_falsy
expect(build.artifacts_metadata.exists?).to be_falsy
end
@@ -475,14 +475,14 @@ describe Ci::API::API do
end
it 'should download artifact' do
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
expect(response.headers).to include download_headers
end
end
context 'build does not has artifacts' do
it 'should respond with not found' do
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
end
end