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

milestone_note_spec.rb « models « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9371cef75408d098032325c7b8dbc3f9ec25c9fb (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe MilestoneNote do
  describe '.from_event' do
    let(:author) { create(:user) }
    let(:project) { create(:project, :repository) }
    let(:noteable) { create(:issue, author: author, project: project) }
    let(:event) { create(:resource_milestone_event, issue: noteable) }

    subject { described_class.from_event(event, resource: noteable, resource_parent: project) }

    it_behaves_like 'a synthetic note', 'milestone'

    context 'with a remove milestone event' do
      let(:milestone) { create(:milestone) }
      let(:event) { create(:resource_milestone_event, action: :remove, issue: noteable, milestone: milestone) }

      it 'creates the expected note' do
        expect(subject.note_html).to include('removed milestone')
        expect(subject.note_html).not_to include('changed milestone to')
        expect(subject.created_at).to eq(event.created_at)
        expect(subject.updated_at).to eq(event.created_at)
      end
    end
  end
end