diff options
Diffstat (limited to 'spec/services/resource_events/synthetic_milestone_notes_builder_service_spec.rb')
-rw-r--r-- | spec/services/resource_events/synthetic_milestone_notes_builder_service_spec.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/spec/services/resource_events/synthetic_milestone_notes_builder_service_spec.rb b/spec/services/resource_events/synthetic_milestone_notes_builder_service_spec.rb index 5e3afeabee7..1b35e224e98 100644 --- a/spec/services/resource_events/synthetic_milestone_notes_builder_service_spec.rb +++ b/spec/services/resource_events/synthetic_milestone_notes_builder_service_spec.rb @@ -6,20 +6,23 @@ RSpec.describe ResourceEvents::SyntheticMilestoneNotesBuilderService do describe '#execute' do let_it_be(:user) { create(:user) } let_it_be(:issue) { create(:issue, author: user) } + let_it_be(:milestone) { create(:milestone, project: issue.project) } - before do - create_list(:resource_milestone_event, 3, issue: issue) - - stub_feature_flags(track_resource_milestone_change_events: false) + let_it_be(:events) do + [ + create(:resource_milestone_event, issue: issue, milestone: milestone, action: :add, created_at: '2020-01-01 04:00'), + create(:resource_milestone_event, issue: issue, milestone: milestone, action: :remove, created_at: '2020-01-02 08:00') + ] end - context 'when resource milestone events are disabled' do - # https://gitlab.com/gitlab-org/gitlab/-/issues/212985 - it 'still builds notes for existing resource milestone events' do - notes = described_class.new(issue, user).execute + it 'builds milestone notes for resource milestone events' do + notes = described_class.new(issue, user).execute - expect(notes.size).to eq(3) - end + expect(notes.map(&:created_at)).to eq(events.map(&:created_at)) + expect(notes.map(&:note)).to eq([ + "changed milestone to %#{milestone.iid}", + 'removed milestone' + ]) end end end |