Skip to content

Simplify managing environment variables in specs

Why is this change being made?

To simplify specs and make sure we are properly checking all ENV variable changes we are introducing this change to use climate-control and helper methods to better manage environment changes.

New class method modify_environment(hash) takes hash of modified environment variables and using around callback modifies environment for selected context.

New helper method with_modified_environment(hash, &block) takes hash of modified environment variables and block and executes the block in the context with modified env.

Related to gitlab-org/gitlab#345629 (closed)

Merge request reports