debian-mirror-gitlab/spec/models/milestone_note_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
1 KiB
Ruby
Raw Normal View History

2020-04-08 14:13:33 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe MilestoneNote do
2020-04-08 14:13:33 +05:30
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) }
2020-07-28 23:09:34 +05:30
it_behaves_like 'a synthetic note', 'milestone'
2020-05-24 23:13:21 +05:30
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')
2023-03-04 22:38:38 +05:30
expect(subject.created_at).to eq(event.created_at)
expect(subject.updated_at).to eq(event.created_at)
2020-05-24 23:13:21 +05:30
end
end
2020-04-08 14:13:33 +05:30
end
end