summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-05-05 13:28:44 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-05-19 22:01:53 +0200
commit9129c37c5bd6e648e23ebe6847b909dd151c7e8a (patch)
tree246c9d85b1bea66e284911a9a3017c23b086f876 /spec
parent83df6384558c27d3ff7282e6d66b06fa7e9c0c60 (diff)
downloadgitlab-ce-9129c37c5bd6e648e23ebe6847b909dd151c7e8a.tar.gz
Add CI API tests for runner config and untagged jobs
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/ci/api/builds_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb
index cae4656010f..7ebf8e41f3b 100644
--- a/spec/requests/ci/api/builds_spec.rb
+++ b/spec/requests/ci/api/builds_spec.rb
@@ -128,6 +128,38 @@ describe Ci::API::API do
end
end
end
+
+ context 'when build has no tags' do
+ before do
+ commit = create(:ci_commit, project: project)
+ create(:ci_build, commit: commit, tags: [])
+ end
+
+ context 'when runner is allowed to pick untagged builds' do
+ before { runner.update_column(:run_untagged, true) }
+
+ it 'picks build' do
+ register_builds
+
+ expect(response).to have_http_status 201
+ end
+ end
+
+ context 'when runner is not allowed to pick untagged builds' do
+ before { runner.update_column(:run_untagged, false) }
+
+ it 'does not pick build' do
+ register_builds
+
+ expect(response).to have_http_status 404
+ end
+ end
+
+ def register_builds
+ post ci_api("/builds/register"), token: runner.token,
+ info: { platform: :darwin }
+ end
+ end
end
describe "PUT /builds/:id" do