Commit 419f39e3 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'dz-fix-v3-api-deployments-spec' into 'master'

Make api/v3/deployments_spec to actually tests v3 instead of current API

See merge request !10965
parents 00e4ec55 22ed9c02
require 'spec_helper' require 'spec_helper'
describe API::Deployments do describe API::V3::Deployments do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:non_member) { create(:user) } let(:non_member) { create(:user) }
let(:project) { deployment.environment.project } let(:project) { deployment.environment.project }
...@@ -24,11 +24,11 @@ describe API::Deployments do ...@@ -24,11 +24,11 @@ describe API::Deployments do
describe 'GET /projects/:id/deployments' do describe 'GET /projects/:id/deployments' do
context 'as member of the project' do context 'as member of the project' do
it_behaves_like 'a paginated resources' do it_behaves_like 'a paginated resources' do
let(:request) { get api("/projects/#{project.id}/deployments", user) } let(:request) { get v3_api("/projects/#{project.id}/deployments", user) }
end end
it 'returns projects deployments' do it 'returns projects deployments' do
get api("/projects/#{project.id}/deployments", user) get v3_api("/projects/#{project.id}/deployments", user)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
expect(json_response).to be_an Array expect(json_response).to be_an Array
...@@ -40,7 +40,7 @@ describe API::Deployments do ...@@ -40,7 +40,7 @@ describe API::Deployments do
context 'as non member' do context 'as non member' do
it 'returns a 404 status code' do it 'returns a 404 status code' do
get api("/projects/#{project.id}/deployments", non_member) get v3_api("/projects/#{project.id}/deployments", non_member)
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
...@@ -50,7 +50,7 @@ describe API::Deployments do ...@@ -50,7 +50,7 @@ describe API::Deployments do
describe 'GET /projects/:id/deployments/:deployment_id' do describe 'GET /projects/:id/deployments/:deployment_id' do
context 'as a member of the project' do context 'as a member of the project' do
it 'returns the projects deployment' do it 'returns the projects deployment' do
get api("/projects/#{project.id}/deployments/#{deployment.id}", user) get v3_api("/projects/#{project.id}/deployments/#{deployment.id}", user)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
expect(json_response['sha']).to match /\A\h{40}\z/ expect(json_response['sha']).to match /\A\h{40}\z/
...@@ -60,7 +60,7 @@ describe API::Deployments do ...@@ -60,7 +60,7 @@ describe API::Deployments do
context 'as non member' do context 'as non member' do
it 'returns a 404 status code' do it 'returns a 404 status code' do
get api("/projects/#{project.id}/deployments/#{deployment.id}", non_member) get v3_api("/projects/#{project.id}/deployments/#{deployment.id}", non_member)
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment