Sha256: da8f107e402bcbe821afe5863bef0cf1b372235fa789f99462cc48f70345e3c9
Contents?: true
Size: 692 Bytes
Versions: 12
Compression:
Stored size: 692 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Discourse class NoMockingJobs < Cop MSG = "Use the test helpers provided by Sidekiq instead of mocking `Jobs.expects(:enqueue)`." def_node_matcher :mocking_jobs_enqueue?, <<~MATCHER (send (const nil? :Jobs) :expects (:sym :enqueue)) MATCHER def_node_matcher :mocking_jobs_enqueue_in?, <<~MATCHER (send (const nil? :Jobs) :expects (:sym :enqueue_in)) MATCHER def on_send(node) if mocking_jobs_enqueue?(node) || mocking_jobs_enqueue_in?(node) add_offense(node, message: MSG) end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems