Add test with inactive error use case for 'POST /ci/api/v1/builds/register.json'

This commit is contained in:
Tomasz Maczukin 2016-09-13 00:36:16 +02:00
parent f369e62a16
commit 5b8613b8e6
No known key found for this signature in database
GPG key ID: 7E9EB2E4B0F625CD
2 changed files with 14 additions and 0 deletions

View file

@ -30,5 +30,9 @@ FactoryGirl.define do
trait :shared do
is_shared true
end
trait :inactive do
active false
end
end
end

View file

@ -158,6 +158,16 @@ describe Ci::API::API do
end
end
context 'when runner is paused' do
let(:inactive_runner) { create(:ci_runner, :inactive, token: "InactiveRunner") }
before do
register_builds inactive_runner.token
end
it { expect(response).to have_http_status 404 }
end
def register_builds(token = runner.token, **params)
post ci_api("/builds/register"), params.merge(token: token), { 'User-Agent' => user_agent }
end