File tree Expand file tree Collapse file tree 4 files changed +37
-2
lines changed
spec/rspec/rails/matchers Expand file tree Collapse file tree 4 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ def arguments_match?(job)
178178 end
179179
180180 def detect_args_signature_mismatch ( jobs )
181- return unless RSpec :: Mocks . configuration . verify_partial_doubles ?
181+ return if skip_signature_verification ?
182182
183183 jobs . each do |job |
184184 args = deserialize_arguments ( job )
@@ -191,6 +191,11 @@ def detect_args_signature_mismatch(jobs)
191191 nil
192192 end
193193
194+ def skip_signature_verification?
195+ !RSpec ::Mocks . configuration . verify_partial_doubles? ||
196+ RSpec ::Mocks . configuration . temporarily_suppress_partial_double_verification
197+ end
198+
194199 def check_args_signature_mismatch ( job_class , job_method , args )
195200 signature = Support ::MethodSignature . new ( job_class . public_instance_method ( job_method ) )
196201 verifier = Support ::StrictSignatureVerifier . new ( signature , args )
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ def arguments_match?(job)
9393
9494 def detect_args_signature_mismatch ( jobs )
9595 return if @method_name . nil?
96- return unless RSpec :: Mocks . configuration . verify_partial_doubles ?
96+ return if skip_signature_verification ?
9797
9898 mailer_class = mailer_class_name . constantize
9999
Original file line number Diff line number Diff line change @@ -398,6 +398,16 @@ def perform; raise StandardError; end
398398 }
399399 end
400400 end
401+
402+ context "when partial double verification is temporarily suspended" do
403+ it "skips signature checks" do
404+ without_partial_double_verification {
405+ expect {
406+ two_args_job . perform_later ( 1 )
407+ } . to have_enqueued_job . with ( 1 )
408+ }
409+ end
410+ end
401411 end
402412
403413 it "passes with provided arguments containing global id object" do
@@ -559,6 +569,16 @@ def perform; raise StandardError; end
559569 }
560570 end
561571 end
572+
573+ context "when partial double verification is temporarily suspended" do
574+ it "skips signature checks" do
575+ keyword_args_job . perform_later ( 1 , 2 )
576+
577+ without_partial_double_verification {
578+ expect ( keyword_args_job ) . to have_been_enqueued . with ( 1 , 2 )
579+ }
580+ end
581+ end
562582 end
563583
564584 it "fails when negated and several jobs enqueued" do
Original file line number Diff line number Diff line change @@ -272,6 +272,16 @@ def test_email; end
272272 }
273273 end
274274 end
275+
276+ context "when partial double verification is temporarily suspended" do
277+ it "skips signature checks" do
278+ without_partial_double_verification {
279+ expect {
280+ TestMailer . email_with_args ( 1 ) . deliver_later
281+ } . to have_enqueued_mail ( TestMailer , :email_with_args ) . with ( 1 )
282+ }
283+ end
284+ end
275285 end
276286
277287 it "generates a failure message" do
You can’t perform that action at this time.
0 commit comments