I have a test that does:
allow_any_instance_of(GoogleMapsService::Client).to receive(:initialize)
and I'm getting warning: removing 'initialize' may cause serious problems
, but I didn't find any other way to stub this.
How can I solve it in another way so I don't get the warning or how can I silence the warning?
Thank you very much
The #initialize method is called on the instance while the #new method is called on the class so you could do something like:
allow(GoogleMapsService::Client).to receive(:new)
See This issue for more context.
I mean why don't you do this
allow(GoogleMapsService::Client).to receive(:new)
instead of
allow(GoogleMapsService::Client).to receive(:initialize)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With