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

update_service_shared_examples.rb « issuable « services « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ff7acc7e90704674be2e93fde070e0f4b51f2bc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

RSpec.shared_examples_for 'issuable update service updating last_edited_at values' do
  context 'when updating the title of the issuable' do
    let(:update_params) { { title: 'updated title' } }

    it 'does not update last_edited values' do
      expect { update_issuable }.to change { issuable.title }.from(issuable.title).to('updated title').and(
        not_change(issuable, :last_edited_at)
      ).and(
        not_change(issuable, :last_edited_by)
      )
    end
  end

  context 'when updating the description of the issuable' do
    let(:update_params) { { description: 'updated description' } }

    it 'updates last_edited values' do
      expect do
        update_issuable
      end.to change { issuable.description }.from(issuable.description).to('updated description').and(
        change { issuable.last_edited_at }
      ).and(
        change { issuable.last_edited_by }
      )
    end
  end
end