Commit 7d2741f9 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'sh-fix-flaky-interpret-service-spec' into 'master'

Fix flaky spec in QuickActions::InterpretService#execute

See merge request gitlab-org/gitlab!50605
parents 353a6d73 c4e9e784
...@@ -789,12 +789,32 @@ RSpec.describe QuickActions::InterpretService do ...@@ -789,12 +789,32 @@ RSpec.describe QuickActions::InterpretService do
project.add_developer(developer2) project.add_developer(developer2)
end end
it_behaves_like 'assign command' do # There's no guarantee that the reference extractor will preserve
# the order of the mentioned users since this is dependent on the
# order in which rows are returned. We just ensure that at least
# one of the mentioned users is assigned.
shared_examples 'assigns to one of the two users' do
let(:content) { "/assign @#{developer.username} @#{developer2.username}" }
it 'assigns to a single user' do
_, updates, message = service.execute(content, issuable)
expect(updates[:assignee_ids].count).to eq(1)
assignee = updates[:assignee_ids].first
expect([developer.id, developer2.id]).to include(assignee)
user = assignee == developer.id ? developer : developer2
expect(message).to match("Assigned #{user.to_reference}.")
end
end
it_behaves_like 'assigns to one of the two users' do
let(:content) { "/assign @#{developer.username} @#{developer2.username}" } let(:content) { "/assign @#{developer.username} @#{developer2.username}" }
let(:issuable) { issue } let(:issuable) { issue }
end end
it_behaves_like 'assign command', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/27989' do it_behaves_like 'assigns to one of the two users' do
let(:content) { "/assign @#{developer.username} @#{developer2.username}" } let(:content) { "/assign @#{developer.username} @#{developer2.username}" }
let(:issuable) { merge_request } let(:issuable) { merge_request }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment