2020-10-24 23:57:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
RSpec.describe Ci::ChangeVariablesService, feature_category: :secrets_management do
|
2020-10-24 23:57:45 +05:30
|
|
|
let(:service) { described_class.new(container: group, current_user: user, params: params) }
|
|
|
|
|
|
|
|
let_it_be(:user) { create(:user) }
|
2021-06-08 01:23:25 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
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
|