diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-05-06 15:06:57 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-05-19 23:01:53 +0300 |
commit | b8cf2a340b3c56eb7e226473034ead2c4e5d609a (patch) | |
tree | bcdf764c36d47151a16f7833b29c02655ed5daa6 /spec/requests | |
parent | 9ba72378fc006ecd353e1447a50d2231df09c851 (diff) |
Set run untagged option when registering a runner
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/ci/api/runners_spec.rb | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/spec/requests/ci/api/runners_spec.rb b/spec/requests/ci/api/runners_spec.rb index 5d6f5f774ea..eb11258cbbb 100644 --- a/spec/requests/ci/api/runners_spec.rb +++ b/spec/requests/ci/api/runners_spec.rb @@ -15,13 +15,17 @@ describe Ci::API::API do context 'when runner token is provided' do before { post ci_api("/runners/register"), token: registration_token } - it 'creates runner' do + it 'creates runner with default values' do expect(response.status).to eq(201) + expect(Ci::Runner.first.run_untagged).to be true end end context 'when runner description is provided' do - before { post ci_api("/runners/register"), token: registration_token, description: "server.hostname" } + before do + post ci_api("/runners/register"), token: registration_token, + description: "server.hostname" + end it 'creates runner' do expect(response.status).to eq(201) @@ -30,7 +34,10 @@ describe Ci::API::API do end context 'when runner tags are provided' do - before { post ci_api("/runners/register"), token: registration_token, tag_list: "tag1, tag2" } + before do + post ci_api("/runners/register"), token: registration_token, + tag_list: "tag1, tag2" + end it 'creates runner' do expect(response.status).to eq(201) @@ -38,6 +45,28 @@ describe Ci::API::API do end end + context 'when option for running untagged jobs is provided' do + context 'when tags are provided' do + it 'creates runner' do + post ci_api("/runners/register"), token: registration_token, + run_untagged: false, + tag_list: ['tag'] + + expect(response.status).to eq(201) + expect(Ci::Runner.first.run_untagged).to be false + end + end + + context 'when tags are not provided' do + it 'does not create runner' do + post ci_api("/runners/register"), token: registration_token, + run_untagged: false + + expect(response.status).to eq(404) + end + end + end + context 'when project token is provided' do let(:project) { FactoryGirl.create(:empty_project) } before { post ci_api("/runners/register"), token: project.runners_token } |