summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-25 09:10:14 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-25 09:10:14 +0000
commit919f0e86ba5997120d02601e648543d1682e8260 (patch)
treea19cd58b0d82a56f46e6c02535253461149b1c6b /spec/serializers
parent866b1f8ed7db9b29b1188ffcba309b92572f354b (diff)
downloadgitlab-ce-919f0e86ba5997120d02601e648543d1682e8260.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/issue_board_entity_spec.rb14
-rw-r--r--spec/serializers/issue_entity_spec.rb16
-rw-r--r--spec/serializers/linked_project_issue_entity_spec.rb16
3 files changed, 39 insertions, 7 deletions
diff --git a/spec/serializers/issue_board_entity_spec.rb b/spec/serializers/issue_board_entity_spec.rb
index 7a6a496912f..0c9c8f05e17 100644
--- a/spec/serializers/issue_board_entity_spec.rb
+++ b/spec/serializers/issue_board_entity_spec.rb
@@ -57,8 +57,18 @@ RSpec.describe IssueBoardEntity do
context 'when issue is of type task' do
let(:resource) { create(:issue, :task, project: project) }
- it 'has a work item path' do
- expect(subject[:real_path]).to eq(project_work_items_path(project, resource.id))
+ context 'when the use_iid_in_work_items_path feature flag is disabled' do
+ before do
+ stub_feature_flags(use_iid_in_work_items_path: false)
+ end
+
+ it 'has a work item path' do
+ expect(subject[:real_path]).to eq(project_work_items_path(project, resource.id))
+ end
+ end
+
+ it 'has a work item path with iid' do
+ expect(subject[:real_path]).to eq(project_work_items_path(project, resource.iid, iid_path: true))
end
end
end
diff --git a/spec/serializers/issue_entity_spec.rb b/spec/serializers/issue_entity_spec.rb
index 25e9e8c17e2..6161d4d7ec2 100644
--- a/spec/serializers/issue_entity_spec.rb
+++ b/spec/serializers/issue_entity_spec.rb
@@ -17,9 +17,19 @@ RSpec.describe IssueEntity do
context 'when issue is of type task' do
let(:resource) { create(:issue, :task, project: project) }
- # This was already a path and not a url when the work items change was introduced
- it 'has a work item path' do
- expect(subject[:web_url]).to eq(project_work_items_path(project, resource.id))
+ context 'when use_iid_in_work_items_path feature flag is disabled' do
+ before do
+ stub_feature_flags(use_iid_in_work_items_path: false)
+ end
+
+ # This was already a path and not a url when the work items change was introduced
+ it 'has a work item path' do
+ expect(subject[:web_url]).to eq(project_work_items_path(project, resource.id))
+ end
+ end
+
+ it 'has a work item path with iid' do
+ expect(subject[:web_url]).to eq(project_work_items_path(project, resource.iid, iid_path: true))
end
end
end
diff --git a/spec/serializers/linked_project_issue_entity_spec.rb b/spec/serializers/linked_project_issue_entity_spec.rb
index c4646754f16..523b89921b6 100644
--- a/spec/serializers/linked_project_issue_entity_spec.rb
+++ b/spec/serializers/linked_project_issue_entity_spec.rb
@@ -51,8 +51,20 @@ RSpec.describe LinkedProjectIssueEntity do
related_issue.update!(issue_type: :task, work_item_type: WorkItems::Type.default_by_type(:task))
end
- it 'returns a work items path' do
- expect(serialized_entity).to include(path: project_work_items_path(related_issue.project, related_issue.id))
+ context 'when use_iid_in_work_items_path feature flag is disabled' do
+ before do
+ stub_feature_flags(use_iid_in_work_items_path: false)
+ end
+
+ it 'returns a work items path' do
+ expect(serialized_entity).to include(path: project_work_items_path(related_issue.project, related_issue.id))
+ end
+ end
+
+ it 'returns a work items path using iid' do
+ expect(serialized_entity).to include(
+ path: project_work_items_path(related_issue.project, related_issue.iid, iid_path: true)
+ )
end
end
end