Module: RSpec

Defined in:
lib/rspec/stubbed_env.rb,
lib/rspec/stubbed_env/version.rb,
lib/rspec/stubbed_env/hide_helpers.rb,
lib/rspec/stubbed_env/stub_helpers.rb,
sig/rspec/stubbed_env/version.rbs

Overview

ENV stubbing is opt-in, via a shared context, rather than global

Usage:

describe 'my stubbed test' do include_context 'with stubbed env' before do stub_env('FOO' => 'is bar') # or, equivalently: stub_env(FOO: 'is bar') # or, equivalently: stub_env('FOO', 'is bar') # or, equivalently: stub_env(FOO: 'is bar') end it 'does a thing' do expect(ENV).to eq('is bar') end end

NOTE: This file was originally written by Liam Bennet (https://github.com/ljkbennett) as part of the stub_env library (https://github.com/ljkbennett/stub_env). It has evolved since then.

Defined Under Namespace

Modules: StubbedEnv