mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-23 03:26:07 +10:00
* master: (66 commits) Fix runners admin view Fix migrations Rename mention of gitlab-git-http-server to gitlab-workhorse Bump Redis requirement to 2.8 for Sidekiq 4 requirements Fix wording on runner setup page add details on how to change saml button label Fix tests Move awards back to gray panel and few improvements to sidebar Few UI improvements to new sidebar implementation Fix tests for new issuable sidebar Update changelog Implement new sidebar for merge request page Make edit link on issuable sidebar works Redesign issue page for new sidebar Move awards css to separate file Implement issuable sidebar partial Update CHANGELOG Clarify cache behavior Run builds from projects with enabled CI Use Gitlab::Git instead of Ci::Git ... Conflicts: db/schema.rb
65 lines
2.0 KiB
Ruby
65 lines
2.0 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe Ci::API::API do
|
|
include ApiHelpers
|
|
include StubGitlabCalls
|
|
|
|
let(:registration_token) { 'abcdefg123456' }
|
|
|
|
before do
|
|
stub_gitlab_calls
|
|
stub_application_setting(ensure_runners_registration_token: registration_token)
|
|
stub_application_setting(runners_registration_token: registration_token)
|
|
end
|
|
|
|
describe "POST /runners/register" do
|
|
describe "should create a runner if token provided" do
|
|
before { post ci_api("/runners/register"), token: registration_token }
|
|
|
|
it { expect(response.status).to eq(201) }
|
|
end
|
|
|
|
describe "should create a runner with description" do
|
|
before { post ci_api("/runners/register"), token: registration_token, description: "server.hostname" }
|
|
|
|
it { expect(response.status).to eq(201) }
|
|
it { expect(Ci::Runner.first.description).to eq("server.hostname") }
|
|
end
|
|
|
|
describe "should create a runner with tags" do
|
|
before { post ci_api("/runners/register"), token: registration_token, tag_list: "tag1, tag2" }
|
|
|
|
it { expect(response.status).to eq(201) }
|
|
it { expect(Ci::Runner.first.tag_list.sort).to eq(["tag1", "tag2"]) }
|
|
end
|
|
|
|
describe "should create a runner if project token provided" do
|
|
let(:project) { FactoryGirl.create(:empty_project) }
|
|
before { post ci_api("/runners/register"), token: project.runners_token }
|
|
|
|
it { expect(response.status).to eq(201) }
|
|
it { expect(project.runners.size).to eq(1) }
|
|
end
|
|
|
|
it "should return 403 error if token is invalid" do
|
|
post ci_api("/runners/register"), token: 'invalid'
|
|
|
|
expect(response.status).to eq(403)
|
|
end
|
|
|
|
it "should return 400 error if no token" do
|
|
post ci_api("/runners/register")
|
|
|
|
expect(response.status).to eq(400)
|
|
end
|
|
end
|
|
|
|
describe "DELETE /runners/delete" do
|
|
let!(:runner) { FactoryGirl.create(:ci_runner) }
|
|
before { delete ci_api("/runners/delete"), token: runner.token }
|
|
|
|
it { expect(response.status).to eq(200) }
|
|
it { expect(Ci::Runner.count).to eq(0) }
|
|
end
|
|
end
|