diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/lib/gitlab/github_import/importer/events/changed_milestone_spec.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/lib/gitlab/github_import/importer/events/changed_milestone_spec.rb')
-rw-r--r-- | spec/lib/gitlab/github_import/importer/events/changed_milestone_spec.rb | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/spec/lib/gitlab/github_import/importer/events/changed_milestone_spec.rb b/spec/lib/gitlab/github_import/importer/events/changed_milestone_spec.rb index bc14b81bd91..371e76efb75 100644 --- a/spec/lib/gitlab/github_import/importer/events/changed_milestone_spec.rb +++ b/spec/lib/gitlab/github_import/importer/events/changed_milestone_spec.rb @@ -18,7 +18,7 @@ RSpec.describe Gitlab::GithubImport::Importer::Events::ChangedMilestone do 'actor' => { 'id' => user.id, 'login' => user.username }, 'event' => event_type, 'commit_id' => nil, - 'milestone_title' => milestone.title, + 'milestone_title' => milestone_title, 'issue_db_id' => issuable.id, 'created_at' => '2022-04-26 18:30:53 UTC', 'issue' => { 'number' => issuable.iid, pull_request: issuable.is_a?(MergeRequest) } @@ -35,11 +35,23 @@ RSpec.describe Gitlab::GithubImport::Importer::Events::ChangedMilestone do end shared_examples 'new event' do - it 'creates a new milestone event' do - expect { importer.execute(issue_event) }.to change { issuable.resource_milestone_events.count } - .from(0).to(1) - expect(issuable.resource_milestone_events.last) - .to have_attributes(expected_event_attrs) + context 'when a matching milestone exists in GitLab' do + let(:milestone_title) { milestone.title } + + it 'creates a new milestone event' do + expect { importer.execute(issue_event) }.to change { issuable.resource_milestone_events.count } + .from(0).to(1) + expect(issuable.resource_milestone_events.last) + .to have_attributes(expected_event_attrs) + end + end + + context 'when a matching milestone does not exist in GitLab' do + let(:milestone_title) { 'A deleted milestone title' } + + it 'does not create a new milestone event without a milestone' do + expect { importer.execute(issue_event) }.not_to change { issuable.resource_milestone_events.count } + end end end |