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

Fix specs

Klaus Zanders6d80bdfdecd8
diff --git a/app/contracts/work_packages/update_contract.rb b/app/contracts/work_packages/update_contract.rb
index 9e9d490b8dc..3425f15be16 100644
--- a/app/contracts/work_packages/update_contract.rb
+++ b/app/contracts/work_packages/update_contract.rb
@@ -82,7 +82,7 @@ module WorkPackages
end
def user_allowed_to_change_parent
- return if model.parent_id.nil?
+ return if model.parent_id.nil? || model.parent.nil?
return unless model.parent_id_changed?
unless model.parent.visible?
diff --git a/spec/requests/api/v3/work_packages/update_resource_spec.rb b/spec/requests/api/v3/work_packages/update_resource_spec.rb
index 94e3f53d418..d16d6404850 100644
--- a/spec/requests/api/v3/work_packages/update_resource_spec.rb
+++ b/spec/requests/api/v3/work_packages/update_resource_spec.rb
@@ -824,10 +824,10 @@ RSpec.describe 'API v3 Work package resource',
it_behaves_like 'multiple errors', 422
- it_behaves_like 'multiple errors of the same type', 2, 'PropertyConstraintViolation'
+ it_behaves_like 'multiple errors of the same type', 3, 'PropertyConstraintViolation'
it_behaves_like 'multiple errors of the same type with messages' do
- let(:message) { ['Subject can\'t be blank.', 'Parent does not exist.'] }
+ let(:message) { ['Subject can\'t be blank.', 'Parent does not exist.', 'Parent may not be accessed.'] }
end
end