From 80cc9df926b5dddfa0d8eeeeaba43bda8fdba401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Wed, 18 Apr 2018 19:28:34 +0200 Subject: [PATCH] Use variables_attributes intead of variables --- app/services/ci/create_pipeline_service.rb | 2 +- spec/services/ci/create_pipeline_service_spec.rb | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 4bbda434c6c..17a53b6a8fd 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -24,7 +24,7 @@ module Ci ignore_skip_ci: ignore_skip_ci, save_incompleted: save_on_errors, seeds_block: block, - variables: params[:variables_attributes], + variables_attributes: params[:variables_attributes], project: project, current_user: current_user) diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 652603df854..24717898c33 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -18,12 +18,12 @@ describe Ci::CreatePipelineService do message: 'Message', ref: ref_name, trigger_request: nil, - variables: nil) + variables_attributes: nil) params = { ref: ref, before: '00000000', after: after, commits: [{ message: message }], - variables_attributes: variables } + variables_attributes: variables_attributes } described_class.new(project, user, params).execute( source, trigger_request: trigger_request) @@ -549,17 +549,17 @@ describe Ci::CreatePipelineService do end context 'when pipeline variables are specified' do - let(:variables) do + let(:variables_attributes) do [{ key: 'first', secret_value: 'world' }, { key: 'second', secret_value: 'second_world' }] end - subject { execute_service(variables: variables) } + subject { execute_service(variables_attributes: variables_attributes) } it 'creates a pipeline with specified variables' do - expect(subject.variables.count).to eq(variables.count) - expect(subject.variables.first.key).to eq(variables.first[:key]) - expect(subject.variables.last.secret_value).to eq(variables.last[:secret_value]) + expect(subject.variables.count).to eq(variables_attributes.count) + expect(subject.variables.first.key).to eq(variables_attributes.first[:key]) + expect(subject.variables.last.secret_value).to eq(variables_attributes.last[:secret_value]) end end end