From be6477df7d832d6ebc949971eca8bcfcabce9b72 Mon Sep 17 00:00:00 2001 From: Songstats Dependency Audit Date: Sat, 29 Aug 2026 22:53:51 +0200 Subject: [PATCH 1/2] Reject serialized execution without a task --- lib/concurrent-ruby/concurrent/executor/serialized_execution.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/concurrent-ruby/concurrent/executor/serialized_execution.rb b/lib/concurrent-ruby/concurrent/executor/serialized_execution.rb index 4db7c7f0c..c496afee6 100644 --- a/lib/concurrent-ruby/concurrent/executor/serialized_execution.rb +++ b/lib/concurrent-ruby/concurrent/executor/serialized_execution.rb @@ -32,6 +32,8 @@ def call # # @raise [ArgumentError] if no task is given def post(executor, *args, &task) + raise ArgumentError.new('no block given') unless block_given? + posts [[executor, args, task]] true end From c5a9ce8dd11575a0cf2311dd70036c5770c369e9 Mon Sep 17 00:00:00 2001 From: Oskar Eichler Date: Sun, 30 Aug 2026 14:38:12 +0700 Subject: [PATCH 2/2] Add serialized execution block coverage --- spec/concurrent/executor/serialized_execution_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/concurrent/executor/serialized_execution_spec.rb b/spec/concurrent/executor/serialized_execution_spec.rb index 11b9bc72c..efe605f15 100644 --- a/spec/concurrent/executor/serialized_execution_spec.rb +++ b/spec/concurrent/executor/serialized_execution_spec.rb @@ -4,6 +4,15 @@ module Concurrent + RSpec.describe SerializedExecution do + + it 'raises an exception when no block is given' do + expect { + subject.post(ImmediateExecutor.new) + }.to raise_error(ArgumentError, 'no block given') + end + end + RSpec.describe SerializedExecutionDelegator do subject { SerializedExecutionDelegator.new(ImmediateExecutor.new) }