|
1 | 1 | require "rspec/rails/feature_check" |
| 2 | +require "support/temporary_assignment" |
2 | 3 |
|
3 | 4 | if RSpec::Rails::FeatureCheck.has_active_job? |
4 | 5 | require "rspec/rails/matchers/active_job" |
@@ -34,6 +35,7 @@ def self.find(_id) |
34 | 35 |
|
35 | 36 | RSpec.describe "ActiveJob matchers", skip: !RSpec::Rails::FeatureCheck.has_active_job? do |
36 | 37 | include ActiveSupport::Testing::TimeHelpers |
| 38 | + include TemporaryAssignment |
37 | 39 |
|
38 | 40 | around do |example| |
39 | 41 | original_logger = ActiveJob::Base.logger |
@@ -388,6 +390,14 @@ def perform; raise StandardError; end |
388 | 390 | }.to have_enqueued_job.with(1, 2) |
389 | 391 | }.to fail_with(/Incorrect arguments passed to KeywordArgsJob: Missing required keyword arguments/) |
390 | 392 | end |
| 393 | + |
| 394 | + context "with partial double verification disabled" do |
| 395 | + it "skips signature checks" do |
| 396 | + with_temporary_assignment(RSpec::Mocks.configuration, :verify_partial_doubles, false) { |
| 397 | + expect { two_args_job.perform_later(1) }.to have_enqueued_job.with(1) |
| 398 | + } |
| 399 | + end |
| 400 | + end |
391 | 401 | end |
392 | 402 |
|
393 | 403 | it "passes with provided arguments containing global id object" do |
@@ -539,6 +549,16 @@ def perform; raise StandardError; end |
539 | 549 | expect(keyword_args_job).to have_been_enqueued.with(1, 2) |
540 | 550 | }.to fail_with(/Incorrect arguments passed to KeywordArgsJob: Missing required keyword arguments/) |
541 | 551 | end |
| 552 | + |
| 553 | + context "with partial double verification disabled" do |
| 554 | + it "skips signature checks" do |
| 555 | + keyword_args_job.perform_later(1, 2) |
| 556 | + |
| 557 | + with_temporary_assignment(RSpec::Mocks.configuration, :verify_partial_doubles, false) { |
| 558 | + expect(keyword_args_job).to have_been_enqueued.with(1, 2) |
| 559 | + } |
| 560 | + end |
| 561 | + end |
542 | 562 | end |
543 | 563 |
|
544 | 564 | it "fails when negated and several jobs enqueued" do |
|
0 commit comments