1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/spec/env_spec.rb
Kyrylo Silin 7ce5ca70bb Add Pry::Env
Env is a helper module to work with environment variables.
2019-06-09 17:11:24 +03:00

26 lines
628 B
Ruby

# frozen_string_literal: true
RSpec.describe Pry::Env do
describe "#[]" do
let(:key) { 'PRYTESTKEY' }
after { ENV.delete(key) }
context "when ENV contains the passed key" do
before { ENV[key] = 'val' }
after { ENV.delete(key) }
specify { expect(described_class[key]).to eq('val') }
end
context "when ENV doesn't contain the passed key" do
specify { expect(described_class[key]).to be_nil }
end
context "when ENV contains the passed key but its value is nil" do
before { ENV[key] = '' }
specify { expect(described_class[key]).to be_nil }
end
end
end