Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/ci/change_variables_service_spec.rb')
-rw-r--r--spec/services/ci/change_variables_service_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/services/ci/change_variables_service_spec.rb b/spec/services/ci/change_variables_service_spec.rb
new file mode 100644
index 00000000000..5f1207eaf58
--- /dev/null
+++ b/spec/services/ci/change_variables_service_spec.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Ci::ChangeVariablesService do
+ let(:service) { described_class.new(container: group, current_user: user, params: params) }
+
+ let_it_be(:user) { create(:user) }
+ let(:group) { spy(:group, variables: []) }
+ let(:params) { { variables_attributes: [{ key: 'new_variable', value: 'variable_value' }] } }
+
+ describe '#execute' do
+ subject(:execute) { service.execute }
+
+ it 'delegates to ActiveRecord update' do
+ execute
+
+ expect(group).to have_received(:update).with(params)
+ end
+ end
+end