Enable RSpec/VerifiedDoubles cop rule
This MR enables RSpec/VerifiedDoubles
.
In https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#optimize-factory-usage we are already mentioning instance_double
(added via gitlab-org/gitlab!32085 (merged) and a nice addition to gitlab-org/gitlab!74630 (merged)).
Quoting https://relishapp.com/rspec/rspec-mocks/docs/verifying-doubles/using-an-instance-double:
An instance_double is the most common type of verifying double. It takes a class name or object as its first argument, then verifies that any methods being stubbed would be present on an instance of that class. In addition, when it receives messages, it verifies that the provided arguments are supported by the method signature, both in terms of arity and allowed or required keyword arguments, if any. The same argument verification happens when you constrain the arguments using with.
In cases where instance_double
cannot be added easily we can simply disable this cop inline.
See https://relishapp.com/rspec/rspec-mocks/v/3-10/docs/basics/test-doubles
We recommend you use verifying doubles whenever possible.
Current offenses for gitlab-org/gitlab
24285 files inspected, 2757 offenses detected
See gitlab-org/gitlab!75885 (89a9cc5b) for a sneak preview.
🤦 master
?? 🤦
Note, I've accidentally committed on master