Skip to content

Add Cop RSpec/EnvMocking

Gabriel Mazetto requested to merge 386536-rubocop-mock-env into master

What does this MR do and why?

Add Cop RSpec/EnvMocking

Bad:

allow(ENV).to receive(:[]).with('FOO').and_return('bar')
allow(ENV).to receive(:fetch).with('FOO').and_return('bar')
allow(ENV).to receive(:[]).with(key).and_return(value)

Good:

stub_env('FOO', 'bar')
stub_env(key, value)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Fixes #386536

Edited by Peter Leitzen

Merge request reports