# frozen_string_literal: true FactoryBot.define do factory :middleware, class: OpenStruct do receiver { -> {} } initialize_with do new(receiver: receiver).tap do |middleware| middleware.define_singleton_method(:call) do |task, &block| receiver.call(task, &block) end end end end end