Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

User CF spec setup added

Dombi Attila8734745db404
diff --git a/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb b/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
index 24bfb05ace9..33aaca06226 100644
--- a/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
+++ b/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
@@ -47,7 +47,7 @@ RSpec.describe 'baseline rendering',
shared_let(:project) { create(:project, types: [type_bug, type_task, type_milestone]) }
shared_let(:user) do
- create(:user,
+ create(:admin,
firstname: 'Itsa',
lastname: 'Me',
member_in_project: project,
@@ -197,14 +197,14 @@ RSpec.describe 'baseline rendering',
# bool_wp_custom_field.id => true, #working
# float_wp_custom_field.id => 2.9, #working
- list_wp_custom_field.id => list_wp_custom_field.possible_values.first, # not working
- multi_list_wp_custom_field.id => multi_list_wp_custom_field.possible_values.take(2) # not working
+ # list_wp_custom_field.id => list_wp_custom_field.possible_values.first, # not working
+ # multi_list_wp_custom_field.id => multi_list_wp_custom_field.possible_values.take(2) # not working
+ user_wp_custom_field.id => [assignee.id.to_s] # not working
# Please leave these alone at the moment until the specs are set up correctly for
# the following fields:
- # user_wp_custom_field.id => [assignee.id.to_s]
- # version_wp_custom_field,
+ # version_wp_custom_field.id => ,
# date_wp_custom_field
}
end
@@ -221,13 +221,13 @@ RSpec.describe 'baseline rendering',
# :"custom_field_#{float_wp_custom_field.id}" => 3.7,
# Not working, needs UI fix
- "custom_field_#{list_wp_custom_field.id}": [list_wp_custom_field.possible_values.second],
- "custom_field_#{multi_list_wp_custom_field.id}": multi_list_wp_custom_field.possible_values.take(3)
+ # "custom_field_#{list_wp_custom_field.id}": [list_wp_custom_field.possible_values.second],
+ # "custom_field_#{multi_list_wp_custom_field.id}": multi_list_wp_custom_field.possible_values.take(3)
+ "custom_field_#{user_wp_custom_field.id}": [user.id.to_s]
# Please leave these alone at the moment until the specs are set up correctly for
# the following fields:
- # :"custom_field_#{user_wp_custom_field.id}" => [user.id.to_s]
# version_wp_custom_field,
# date_wp_custom_field
}
@@ -235,11 +235,17 @@ RSpec.describe 'baseline rendering',
shared_let(:wp_task_cf) do
wp = Timecop.travel(5.days.ago) do
- create(:work_package,
- project:,
- type: type_task,
- subject: 'A task',
- custom_values: initial_custom_values)
+ # We do not have a logged in user and setting a user id for the custom_values user field
+ # fails validation, because the AnonymousUser does not have visibility to any users.
+ # To solve the issue, we create the work package as `user`.
+ User.execute_as user do
+ create(:work_package,
+ :skip_validations,
+ project:,
+ type: type_task,
+ subject: 'A task',
+ custom_values: initial_custom_values)
+ end
end
WorkPackages::UpdateService
@@ -340,19 +346,25 @@ RSpec.describe 'baseline rendering',
# '2.9',
# '3.7'
# ]
- baseline.expect_changed_attributes wp_task_cf,
- "customField#{list_wp_custom_field.id}": [
- list_wp_custom_field.possible_values.first.value,
- list_wp_custom_field.possible_values.second.value
- ]
+ # baseline.expect_changed_attributes wp_task_cf,
+ # "customField#{list_wp_custom_field.id}": [
+ # list_wp_custom_field.possible_values.first.value,
+ # list_wp_custom_field.possible_values.second.value
+ # ]
- # This expectation is not clear if it works, because the multi values are being joined just by a
- # space, probably a rework on the expectation is also needed.
+ # # This expectation is not clear if it works, because the multi values are being joined just by a
+ # # space, probably a rework on the expectation is also needed.
+
+ # baseline.expect_changed_attributes wp_task_cf,
+ # "customField#{multi_list_wp_custom_field.id}": [
+ # multi_list_wp_custom_field.possible_values.take(3).pluck(:value).join(" "),
+ # multi_list_wp_custom_field.possible_values.take(2).pluck(:value).join(" ")
+ # ]
baseline.expect_changed_attributes wp_task_cf,
- "customField#{multi_list_wp_custom_field.id}": [
- multi_list_wp_custom_field.possible_values.take(3).pluck(:value).join(" "),
- multi_list_wp_custom_field.possible_values.take(2).pluck(:value).join(" ")
+ "customField#{user_wp_custom_field.id}": [
+ 'Assigned User',
+ 'Itsa Me'
]
# show icons on work package single card