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

Reload work package before expected_body

Oliver Günther3bdafeb630f0
diff --git a/modules/bim/app/services/bim/bcf/issues/delete_service.rb b/modules/bim/app/services/bim/bcf/issues/delete_service.rb
index f8b9c9de2ee..f49a03322bb 100644
--- a/modules/bim/app/services/bim/bcf/issues/delete_service.rb
+++ b/modules/bim/app/services/bim/bcf/issues/delete_service.rb
@@ -34,7 +34,7 @@ module Bim::Bcf
private
def after_validate(params, contract_call)
- wp_call = work_package_delete_call
+ wp_call = work_package_delete_call(params)
if wp_call.success?
contract_call
@@ -43,7 +43,7 @@ module Bim::Bcf
end
end
- def work_package_delete_call
+ def work_package_delete_call(params)
associated_wp = WorkPackage.find(model.work_package_id)
# Load the project association as AR fails do do so once the work package
# is destroyed.
diff --git a/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb b/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb
index a794950fb13..ef35b602b09 100644
--- a/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb
+++ b/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb
@@ -156,6 +156,8 @@ describe 'BCF 2.1 topics resource', type: :request, content_type: :json, with_ma
it_behaves_like 'bcf api successful response' do
let(:expected_body) do
+ work_package.reload
+
[
{
"assigned_to": assignee.mail,
@@ -200,6 +202,8 @@ describe 'BCF 2.1 topics resource', type: :request, content_type: :json, with_ma
it_behaves_like 'bcf api successful response' do
let(:expected_body) do
+ work_package.reload
+
{
"assigned_to": assignee.mail,
"creation_author": work_package.author.mail,
@@ -250,6 +254,8 @@ describe 'BCF 2.1 topics resource', type: :request, content_type: :json, with_ma
it_behaves_like 'bcf api successful response' do
let(:expected_body) do
+ work_package.reload
+
{
"assigned_to": assignee.mail,
"creation_author": work_package.author.mail,
@@ -538,8 +544,8 @@ describe 'BCF 2.1 topics resource', type: :request, content_type: :json, with_ma
it_behaves_like 'bcf api successful response' do
let(:expected_status) { 201 }
let(:expected_body) do
- issue = Bim::Bcf::Issue.last
- work_package = WorkPackage.last
+ issue = Bim::Bcf::Issue.last.reload
+ work_package = WorkPackage.last.reload
{
guid: issue&.uuid,
@@ -578,8 +584,8 @@ describe 'BCF 2.1 topics resource', type: :request, content_type: :json, with_ma
it_behaves_like 'bcf api successful response' do
let(:expected_status) { 201 }
let(:expected_body) do
- issue = Bim::Bcf::Issue.last
- work_package = WorkPackage.last
+ issue = Bim::Bcf::Issue.last.reload
+ work_package = WorkPackage.last.reload
{
guid: issue&.uuid,