2020-02-19 13:09:10 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe MilestoneNote do
|
2020-02-19 13:09:10 -05:00
|
|
|
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-15 08:09:26 -04:00
|
|
|
it_behaves_like 'a synthetic note', 'milestone'
|
2020-05-14 11:08:14 -04:00
|
|
|
|
|
|
|
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')
|
|
|
|
end
|
|
|
|
end
|
2020-02-19 13:09:10 -05:00
|
|
|
end
|
|
|
|
end
|