From 13032b713d0943c2b7e2f2a3b886ef06be8e88ef Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Wed, 13 Jan 2016 18:30:49 +0100 Subject: [PATCH] Add seperated 'describe' block for build trace specs --- spec/requests/api/builds_spec.rb | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/spec/requests/api/builds_spec.rb b/spec/requests/api/builds_spec.rb index e5567d42500..8c9f5a382b7 100644 --- a/spec/requests/api/builds_spec.rb +++ b/spec/requests/api/builds_spec.rb @@ -73,7 +73,7 @@ describe API::API, api: true do end end - describe 'GET /projects/:id/builds/:build_id(/trace)?' do + describe 'GET /projects/:id/builds/:build_id' do context 'authorized user' do it 'should return specific build data' do get api("/projects/#{project.id}/builds/#{build.id}", user) @@ -81,13 +81,6 @@ describe API::API, api: true do expect(response.status).to eq(200) expect(json_response['name']).to eq('test') end - - it 'should return specific build trace' do - get api("/projects/#{project.id}/builds/#{build_with_trace.id}/trace", user) - - expect(response.status).to eq(200) - expect(response.body).to eq(build_with_trace.trace) - end end context 'unauthorized user' do @@ -96,7 +89,20 @@ describe API::API, api: true do expect(response.status).to eq(401) end + end + end + describe 'GET /projects/:id/builds/:build_id/trace' do + context 'authorized user' do + it 'should return specific build trace' do + get api("/projects/#{project.id}/builds/#{build_with_trace.id}/trace", user) + + expect(response.status).to eq(200) + expect(response.body).to eq(build_with_trace.trace) + end + end + + context 'unauthorized user' do it 'should not return specific build trace' do get api("/projects/#{project.id}/builds/#{build_with_trace.id}/trace")