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

change_variables_service_spec.rb « ci « services « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b710ca785546055e29b4964f699eba7581de7fe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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