Sha256: 4392243f0e6eb65fe409d98af1226d67ad91a0fdea69032b12ba33d3132332e3

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

describe Kumogata::ConfigParser do
  subject { Kumogata::ConfigParser.new }

  it 'parse aws/config' do
    content = <<-EOS
[default]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
aws_security_token = texample123324

[profile2]
aws_access_key_id = xAKIAIOSFODNN7EXAMPLE
aws_secret_access_key = xwJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
aws_security_token = xtexample123324

[invalid]
    EOS

    tempfile(content) do |config|
      subject.path = config.path
      subject.parse!

      expect(subject[:default]).to eq(
        'aws_access_key_id' => 'AKIAIOSFODNN7EXAMPLE',
        'aws_secret_access_key' => 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
        'aws_security_token' => 'texample123324',
      )

      expect(subject['profile2']).to eq(
        'aws_access_key_id' => 'xAKIAIOSFODNN7EXAMPLE',
        'aws_secret_access_key' => 'xwJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
        'aws_security_token' => 'xtexample123324',
      )

      expect(subject['invalid']).to be_nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kumogata-0.4.19 spec/kumogata_config_parser_spec.rb
kumogata-0.4.18 spec/kumogata_config_parser_spec.rb