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

rewrite test in a better way

Christophe Bliard6f5bb8f76225
diff --git a/spec/workers/notifications/group_member_altered_job_spec.rb b/spec/workers/notifications/group_member_altered_job_spec.rb
index e869a06ce5a..4773cee0dd0 100644
--- a/spec/workers/notifications/group_member_altered_job_spec.rb
+++ b/spec/workers/notifications/group_member_altered_job_spec.rb
@@ -75,14 +75,13 @@ describe Notifications::GroupMemberAlteredJob, type: :model do
end
it 'propagates the given current user when sending notifications' do
- notifications_called = false
+ captured_current_user = nil
allow(OpenProject::Notifications)
.to receive(:send) do |_args|
- expect(User.current).to be(current_user)
- notifications_called = true
+ captured_current_user = User.current
end
service_call
- expect(notifications_called).to be(true)
+ expect(captured_current_user).to be(current_user)
end
end