Commit 97c63eb7 authored by Shinya Maeda's avatar Shinya Maeda

Add proper test for api/triggers_spec.rb

parent 610a755f
...@@ -184,6 +184,23 @@ describe API::Triggers do ...@@ -184,6 +184,23 @@ describe API::Triggers do
expect(json_response['message']).to eq('400 Job has to be running') expect(json_response['message']).to eq('400 Job has to be running')
end end
end end
context 'when variables are defined' do
let(:params) do
{ ref: 'refs/heads/other-branch',
variables: { 'KEY' => 'VALUE' } }
end
it 'creates a new pipeline with a variable' do
expect { subject }.to change(Ci::Pipeline, :count)
.and change(Ci::PipelineVariable, :count)
expect(response).to have_http_status(201)
expect(Ci::Pipeline.last.source).to eq('pipeline')
expect(Ci::Pipeline.last.triggered_by_pipeline).not_to be_nil
expect(Ci::Pipeline.last.variables.map { |v| { v.key => v.value } }.last).to eq(params[:variables])
end
end
end end
end end
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