Introducing rspec-stubbed_env
ENV stubbing via a shared context for more powerful tests. Installation Add this line to your application’s Gemfile:
gem 'rspec-stubbed_env', group: :test And then execute:
$ bundle Or install it yourself as:
$ gem install rspec-stubbed_env You must configure RSpec to use the :expect syntax, or some compatible alternative.
RSpec.configure do |config| config.expect_with :rspec do |c| c.syntax = :expect end end Require the library in your spec/test helper somewhere:
require 'rspec/stubbed_env' Usage ENV stubbing: