Skip to content

Commit

Permalink
Disable RSpec/VerifiedDoubles cop
Browse files Browse the repository at this point in the history
We often want to test duck-typed interfaces rather than specific
classes, especially in the context of the Google API client, which
returns dynamic objects that RSpec's `instance_double` can't verify.
  • Loading branch information
csutter committed Oct 31, 2023
1 parent cf4198a commit 3ea0807
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ inherit_mode:
merge:
- Exclude

# We often want to test duck-typed interfaces rather than specific classes, especially in the
# context of the Google API client, which returns dynamic objects that RSpec's `instance_double`
# can't verify.
RSpec/VerifiedDoubles:
Enabled: false

# **************************************************************
# TRY NOT TO ADD OVERRIDES IN THIS FILE
#
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/document_sync_worker/document/publish_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
subject(:document) { described_class.new(document_hash) }

let(:repository) do
double("repository", put: nil) # rubocop:disable RSpec/VerifiedDoubles (interface)
double("repository", put: nil)
end

let(:content_id) { "123" }
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/document_sync_worker/document/unpublish_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
subject(:document) { described_class.new(document_hash) }

let(:repository) do
double("repository", delete: nil) # rubocop:disable RSpec/VerifiedDoubles (interface)
double("repository", delete: nil)
end

let(:content_id) { "123" }
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/document_sync_worker/message_processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
subject(:processor) { described_class.new(repository:) }

let(:repository) { double }
let(:document) { double(synchronize_to: nil) } # rubocop:disable RSpec/VerifiedDoubles (interface)
let(:document) { double(synchronize_to: nil) }

it_behaves_like "a message queue processor"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
context "when updating the document succeeds" do
before do
allow(client).to receive(:update_document).and_return(
double(name: "document-name"), # rubocop:disable RSpec/VerifiedDoubles
double(name: "document-name"),
)

repository.put(
Expand Down

0 comments on commit 3ea0807

Please sign in to comment.