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

synthetic_notes_builder_shared_examples.rb « resource_events « services « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 716bee39fcae130335414a613dd95ef44ceb6cb9 (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
# frozen_string_literal: true

RSpec.shared_examples 'filters by paginated notes' do |event_type|
  let(:event) { create(event_type) } # rubocop:disable Rails/SaveBang

  before do
    create(event_type, issue: event.issue)
  end

  it 'only returns given notes' do
    paginated_notes = { event_type.to_s.pluralize => [double(id: event.id)] }
    notes = described_class.new(event.issue, user, paginated_notes: paginated_notes).execute

    expect(notes.size).to eq(1)
    expect(notes.first.event).to eq(event)
  end

  context 'when paginated notes is empty' do
    it 'does not return any notes' do
      notes = described_class.new(event.issue, user, paginated_notes: {}).execute

      expect(notes.size).to eq(0)
    end
  end
end