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

unsubscribe from OP notification to avoid affecting other specs

ulfertsa78b59d4792c
diff --git a/spec/models/work_package/openproject_notifications_spec.rb b/spec/models/work_package/openproject_notifications_spec.rb
index 0a1f7779806..e7b0940308b 100644
--- a/spec/models/work_package/openproject_notifications_spec.rb
+++ b/spec/models/work_package/openproject_notifications_spec.rb
@@ -45,19 +45,23 @@ describe WorkPackage, type: :model do
let(:journal_ids) { [] }
- before do
+ let!(:subscription) do
OpenProject::Notifications.subscribe(OpenProject::Events::AGGREGATED_WORK_PACKAGE_JOURNAL_READY) do |payload|
journal_ids << payload[:journal_id]
end
end
+ after do
+ OpenProject::Notifications.unsubscribe(OpenProject::Events::AGGREGATED_WORK_PACKAGE_JOURNAL_READY, subscription)
+ end
+
context 'after creation' do
before do
work_package
end
it "are triggered" do
- expect(journal_ids).to include (work_package.journals.last.id)
+ expect(journal_ids).to include(work_package.journals.last.id)
end
end
@@ -71,7 +75,7 @@ describe WorkPackage, type: :model do
end
it "are triggered" do
- expect(journal_ids).to include (work_package.journals.last.id)
+ expect(journal_ids).to include(work_package.journals.last.id)
end
end
end