@@ -42,6 +42,13 @@ def self.find(_id)
4242    ActiveJob ::Base . logger  =  original_logger 
4343  end 
4444
45+   around  do  |example |
46+     original_value  =  RSpec ::Mocks . configuration . verify_partial_doubles? 
47+     example . run 
48+   ensure 
49+     RSpec ::Mocks . configuration . verify_partial_doubles  =  original_value 
50+   end 
51+ 
4552  let ( :heavy_lifting_job )  do 
4653    Class . new ( ActiveJob ::Base )  do 
4754      def  perform ;  end 
@@ -372,20 +379,42 @@ def perform; raise StandardError; end
372379      } . to  have_enqueued_job . with ( 42 ,  "David" ) 
373380    end 
374381
375-     it   "fails if  the arguments do not  match the job's signature"do 
376-       expect   { 
382+     describe   "verifying  the arguments passed  match the job's signature"do 
383+       it   "fails if there is an arity mismatch"   do 
377384        expect  { 
378-           two_args_job . perform_later ( 1 ) 
379-         } . to  have_enqueued_job . with ( 1 ) 
380-       } . to  fail_with ( /Incorrect arguments passed to TwoArgsJob: Wrong number of arguments/ ) 
381-     end 
385+           expect  { 
386+             two_args_job . perform_later ( 1 ) 
387+           } . to  have_enqueued_job . with ( 1 ) 
388+         } . to  fail_with ( /Incorrect arguments passed to TwoArgsJob: Wrong number of arguments/ ) 
389+       end 
382390
383-     it  "fails if the job's signature/arguments are mismatched keyword/positional arguments"  do 
384-       expect  { 
391+       it  "fails if there is a keyword/positional arguments mismatch"  do 
385392        expect  { 
386-           keyword_args_job . perform_later ( 1 ,  2 ) 
387-         } . to  have_enqueued_job . with ( 1 ,  2 ) 
388-       } . to  fail_with ( /Incorrect arguments passed to KeywordArgsJob: Missing required keyword arguments/ ) 
393+           expect  { 
394+             keyword_args_job . perform_later ( 1 ,  2 ) 
395+           } . to  have_enqueued_job . with ( 1 ,  2 ) 
396+         } . to  fail_with ( /Incorrect arguments passed to KeywordArgsJob: Missing required keyword arguments/ ) 
397+       end 
398+ 
399+       context  "with partial double verification disabled"  do 
400+         before  do 
401+           RSpec ::Mocks . configuration . verify_partial_doubles  =  false 
402+         end 
403+ 
404+         it  "skips signature checks"  do 
405+           expect  {  two_args_job . perform_later ( 1 )  } . to  have_enqueued_job . with ( 1 ) 
406+         end 
407+       end 
408+ 
409+       context  "when partial double verification is temporarily suspended"  do 
410+         it  "skips signature checks"  do 
411+           without_partial_double_verification  { 
412+             expect  { 
413+               two_args_job . perform_later ( 1 ) 
414+             } . to  have_enqueued_job . with ( 1 ) 
415+           } 
416+         end 
417+       end 
389418    end 
390419
391420    it  "passes with provided arguments containing global id object"  do 
@@ -521,20 +550,44 @@ def perform; raise StandardError; end
521550      } . to  fail_with ( /expected to enqueue exactly 1 jobs, but enqueued 0/ ) 
522551    end 
523552
524-     it  "fails if the arguments do not match the job's signature"  do 
525-       two_args_job . perform_later ( 1 ) 
553+     describe  "verifying the arguments passed match the job's signature"  do 
554+       it  "fails if there is an arity mismatch"  do 
555+         two_args_job . perform_later ( 1 ) 
526556
527-       expect  { 
528-         expect ( two_args_job ) . to  have_been_enqueued . with ( 1 ) 
529-       } . to  fail_with ( /Incorrect arguments passed to TwoArgsJob: Wrong number of arguments/ ) 
530-     end 
557+          expect  { 
558+            expect ( two_args_job ) . to  have_been_enqueued . with ( 1 ) 
559+          } . to  fail_with ( /Incorrect arguments passed to TwoArgsJob: Wrong number of arguments/ ) 
560+        end 
531561
532-     it  "fails if the job's signature/arguments are mismatched  keyword/positional arguments"  do 
533-       keyword_args_job . perform_later ( 1 ,  2 ) 
562+        it  "fails if there is a  keyword/positional arguments mismatch "  do 
563+          keyword_args_job . perform_later ( 1 ,  2 ) 
534564
535-       expect  { 
536-         expect ( keyword_args_job ) . to  have_been_enqueued . with ( 1 ,  2 ) 
537-       } . to  fail_with ( /Incorrect arguments passed to KeywordArgsJob: Missing required keyword arguments/ ) 
565+         expect  { 
566+           expect ( keyword_args_job ) . to  have_been_enqueued . with ( 1 ,  2 ) 
567+         } . to  fail_with ( /Incorrect arguments passed to KeywordArgsJob: Missing required keyword arguments/ ) 
568+       end 
569+ 
570+       context  "with partial double verification disabled"  do 
571+         before  do 
572+           RSpec ::Mocks . configuration . verify_partial_doubles  =  false 
573+         end 
574+ 
575+         it  "skips signature checks"  do 
576+           keyword_args_job . perform_later ( 1 ,  2 ) 
577+ 
578+           expect ( keyword_args_job ) . to  have_been_enqueued . with ( 1 ,  2 ) 
579+         end 
580+       end 
581+ 
582+       context  "when partial double verification is temporarily suspended"  do 
583+         it  "skips signature checks"  do 
584+           keyword_args_job . perform_later ( 1 ,  2 ) 
585+ 
586+           without_partial_double_verification  { 
587+             expect ( keyword_args_job ) . to  have_been_enqueued . with ( 1 ,  2 ) 
588+           } 
589+         end 
590+       end 
538591    end 
539592
540593    it  "fails when negated and several jobs enqueued"  do 
0 commit comments