Sha256: fd1c033c7b98de4611933638fa22eac598bb24e5aaaf32117daa3886975f2822

Contents?: true

Size: 676 Bytes

Versions: 2

Compression:

Stored size: 676 Bytes

Contents

require 'spec_helper'

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

2 entries across 2 versions & 1 rubygems

Version Path
envied-0.9.1 spec/env_var_extractor_spec.rb
envied-0.9.0 spec/env_var_extractor_spec.rb