Commit 46317b7d authored by Jacopo's avatar Jacopo

Removes variables from pipelines api

parent 3871ea33
...@@ -133,8 +133,7 @@ Example of response ...@@ -133,8 +133,7 @@ Example of response
"finished_at": null, "finished_at": null,
"committed_at": null, "committed_at": null,
"duration": null, "duration": null,
"coverage": null, "coverage": null
"variables": []
} }
``` ```
......
...@@ -1067,7 +1067,6 @@ module API ...@@ -1067,7 +1067,6 @@ module API
expose :created_at, :updated_at, :started_at, :finished_at, :committed_at expose :created_at, :updated_at, :started_at, :finished_at, :committed_at
expose :duration expose :duration
expose :coverage expose :coverage
expose :variables, using: Entities::Variable
end end
class PipelineSchedule < Grape::Entity class PipelineSchedule < Grape::Entity
......
...@@ -285,6 +285,15 @@ describe API::Pipelines do ...@@ -285,6 +285,15 @@ describe API::Pipelines do
end end
describe 'POST /projects/:id/pipeline ' do describe 'POST /projects/:id/pipeline ' do
def expect_variables(variables, expected_variables)
variables.each_with_index do |variable, index|
expected_variable = expected_variables[index]
expect(variable.key).to eq(expected_variable['key'])
expect(variable.value).to eq(expected_variable['value'])
end
end
context 'authorized user' do context 'authorized user' do
context 'with gitlab-ci.yml' do context 'with gitlab-ci.yml' do
before do before do
...@@ -308,11 +317,12 @@ describe API::Pipelines do ...@@ -308,11 +317,12 @@ describe API::Pipelines do
expect do expect do
post api("/projects/#{project.id}/pipeline", user), ref: project.default_branch, variables: variables post api("/projects/#{project.id}/pipeline", user), ref: project.default_branch, variables: variables
end.to change { project.pipelines.count }.by(1) end.to change { project.pipelines.count }.by(1)
expect_variables(project.pipelines.last.variables, variables)
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(201)
expect(json_response).to be_a Hash expect(json_response).to be_a Hash
expect(json_response['sha']).to eq project.commit.id expect(json_response['sha']).to eq project.commit.id
expect(json_response['variables']).to eq variables expect(json_response).not_to have_key('variables')
end end
end end
...@@ -328,11 +338,12 @@ describe API::Pipelines do ...@@ -328,11 +338,12 @@ describe API::Pipelines do
expect do expect do
post api("/projects/#{project.id}/pipeline", user), ref: project.default_branch, variables: variables post api("/projects/#{project.id}/pipeline", user), ref: project.default_branch, variables: variables
end.to change { project.pipelines.count }.by(1) end.to change { project.pipelines.count }.by(1)
expect_variables(project.pipelines.last.variables, variables)
expect(response).to have_gitlab_http_status(201) expect(response).to have_gitlab_http_status(201)
expect(json_response).to be_a Hash expect(json_response).to be_a Hash
expect(json_response['sha']).to eq project.commit.id expect(json_response['sha']).to eq project.commit.id
expect(json_response['variables']).to eq variables expect(json_response).not_to have_key('variables')
end end
context 'condition unmatch' do context 'condition unmatch' do
......
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