I have a User
AR model and when I save a User
instance with a populated value of remote_avatar_url
, Carrierwave automatically downloads the avatar. More info about this feature here.
Now, in my tests, I want to stub this behavior. I know I can do:
allow_any_instance_of(UserAvatarUploader).to receive(:download!)
however, the rspec-mocks
documentation discourages the use of allow/expect_any_instance_of
.
What is the proper way of stubbing this specific feature of Carrierwave in tests?
P.S. I have already disabled image processing in tests:
config.enable_processing = false if Rails.env.test?