Sha256: 3ae57e636a80e4c4c82999945c2068cc6a8eebce141c6168851999febe156363

Contents?: true

Size: 659 Bytes

Versions: 4

Compression:

Stored size: 659 Bytes

Contents

RSpec.describe ENVied::EnvVarExtractor do

  describe "#capture_variables" do
    def capture_variables(text)
      described_class.new.capture_variables(text)
    end

    {
      %{self.a = ENV['A']} => %w(A),
      %{self.a = ENV["A"]} => %w(A),
      %{self.a = ENV.fetch('A')]} => %w(A),
      %{self.a = ENV.fetch("A")]} => %w(A),
      %{# self.a = ENV["A"]} => %w(A),
      %{self.a = ENV["A"] && self.b = ENV["B"]} => %w(A B),
      %{self.a = ENV["A3"]} => %w(A3)
    }.each do |line, expected|
      it "captures #{expected} from #{line.inspect}" do
        expect(capture_variables(line)).to contain_exactly(*expected)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
envied-0.9.3 spec/env_var_extractor_spec.rb
envied-0.9.2 spec/env_var_extractor_spec.rb
envied-0.9.2.rc2 spec/env_var_extractor_spec.rb
envied-0.9.2.rc1 spec/env_var_extractor_spec.rb