diff options
author | Valery Sizov <valery@gitlab.com> | 2016-10-19 15:25:37 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2016-11-01 14:46:59 +0200 |
commit | a6ba358a8fe5a965a46ca07c8c0382348b2b8d8c (patch) | |
tree | a1ac8c2fe33e9a618a347e890ed9ab6a0cf4bbba /spec/requests/ci | |
parent | 957308af84ca8312ea362c7272a4008dac808086 (diff) | |
download | gitlab-ce-a6ba358a8fe5a965a46ca07c8c0382348b2b8d8c.tar.gz |
Make specs a bit fasterspec_optimization
Diffstat (limited to 'spec/requests/ci')
-rw-r--r-- | spec/requests/ci/api/builds_spec.rb | 25 | ||||
-rw-r--r-- | spec/requests/ci/api/runners_spec.rb | 10 |
2 files changed, 22 insertions, 13 deletions
diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb index 7b7d62feb2c..6d49c42c215 100644 --- a/spec/requests/ci/api/builds_spec.rb +++ b/spec/requests/ci/api/builds_spec.rb @@ -220,26 +220,33 @@ describe Ci::API::API do end context 'when request is valid' do - it { expect(response.status).to eq 202 } + it 'gets correct response' do + expect(response.status).to eq 202 + expect(response.header).to have_key 'Range' + expect(response.header).to have_key 'Build-Status' + end + it { expect(build.reload.trace).to eq 'BUILD TRACE appended' } - it { expect(response.header).to have_key 'Range' } - it { expect(response.header).to have_key 'Build-Status' } end context 'when content-range start is too big' do let(:headers_with_range) { headers.merge({ 'Content-Range' => '15-20' }) } - it { expect(response.status).to eq 416 } - it { expect(response.header).to have_key 'Range' } - it { expect(response.header['Range']).to eq '0-11' } + it 'gets correct response' do + expect(response.status).to eq 416 + expect(response.header).to have_key 'Range' + expect(response.header['Range']).to eq '0-11' + end end context 'when content-range start is too small' do let(:headers_with_range) { headers.merge({ 'Content-Range' => '8-20' }) } - it { expect(response.status).to eq 416 } - it { expect(response.header).to have_key 'Range' } - it { expect(response.header['Range']).to eq '0-11' } + it 'gets correct response' do + expect(response.status).to eq 416 + expect(response.header).to have_key 'Range' + expect(response.header['Range']).to eq '0-11' + end end context 'when Content-Range header is missing' do diff --git a/spec/requests/ci/api/runners_spec.rb b/spec/requests/ci/api/runners_spec.rb index 43596f07cb5..d6c26fd8a94 100644 --- a/spec/requests/ci/api/runners_spec.rb +++ b/spec/requests/ci/api/runners_spec.rb @@ -109,10 +109,12 @@ describe Ci::API::API do end describe "DELETE /runners/delete" do - let!(:runner) { FactoryGirl.create(:ci_runner) } - before { delete ci_api("/runners/delete"), token: runner.token } + it 'returns 200' do + runner = FactoryGirl.create(:ci_runner) + delete ci_api("/runners/delete"), token: runner.token - it { expect(response).to have_http_status 200 } - it { expect(Ci::Runner.count).to eq(0) } + expect(response).to have_http_status 200 + expect(Ci::Runner.count).to eq(0) + end end end |