Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-10-19 15:57:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-19 15:57:54 +0300
commit419c53ec62de6e97a517abd5fdd4cbde3a942a34 (patch)
tree1f43a548b46bca8a5fb8fe0c31cef1883d49c5b6 /spec/models/work_item_spec.rb
parent1da20d9135b3ad9e75e65b028bffc921aaf8deb7 (diff)
Add latest changes from gitlab-org/gitlab@16-5-stable-eev16.5.0-rc42
Diffstat (limited to 'spec/models/work_item_spec.rb')
-rw-r--r--spec/models/work_item_spec.rb25
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/models/work_item_spec.rb b/spec/models/work_item_spec.rb
index 4b675faf99e..3294d53e364 100644
--- a/spec/models/work_item_spec.rb
+++ b/spec/models/work_item_spec.rb
@@ -287,7 +287,7 @@ RSpec.describe WorkItem, feature_category: :portfolio_management do
it_behaves_like 'internal event tracking' do
let(:work_item) { create(:work_item) }
- let(:action) { Gitlab::UsageDataCounters::IssueActivityUniqueCounter::ISSUE_CREATED }
+ let(:event) { Gitlab::UsageDataCounters::IssueActivityUniqueCounter::ISSUE_CREATED }
let(:project) { work_item.project }
let(:user) { work_item.author }
let(:namespace) { project.namespace }
@@ -713,5 +713,28 @@ RSpec.describe WorkItem, feature_category: :portfolio_management do
.to contain_exactly(authorized_item_b, authorized_item_c, unauthorized_item)
end
end
+
+ context 'when work item is a new record' do
+ let(:new_work_item) { build(:work_item, project: authorized_project) }
+
+ it { expect(new_work_item.linked_work_items(user)).to be_empty }
+ end
+ end
+
+ describe '#linked_items_count' do
+ let_it_be(:item1) { create(:work_item, :issue, project: reusable_project) }
+ let_it_be(:item2) { create(:work_item, :issue, project: reusable_project) }
+ let_it_be(:item3) { create(:work_item, :issue, project: reusable_project) }
+ let_it_be(:item4) { build(:work_item, :issue, project: reusable_project) }
+
+ it 'returns number of items linked to the work item' do
+ create(:work_item_link, source: item1, target: item2)
+ create(:work_item_link, source: item1, target: item3)
+
+ expect(item1.linked_items_count).to eq(2)
+ expect(item2.linked_items_count).to eq(1)
+ expect(item3.linked_items_count).to eq(1)
+ expect(item4.linked_items_count).to eq(0)
+ end
end
end