It seems I canβt just check if the block with the method chain has passed. And I found one dull answer, Block Implementation:
RSpec.describe do it do obj = double proc = Proc.new{} expect(obj).to receive(:method).with(1, 2, 3) do |*args, &block| expect(proc).to be(block) end obj.method(1, 2, 3, &proc) end end
However, we cannot use the implementation of the block and other methods for tuning the response at the same time as receive(:method).with(1, 2, 3){|*| ...}.and_call_original receive(:method).with(1, 2, 3){|*| ...}.and_call_original .
sh01ch1
source share