Sha256: 360d82634506ef862293a2aba560e29c28823f94b7d88a0de72d272f15de65e6

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true
require 'rspectacular'
require 'chamber/commands/secure'
require 'fileutils'

module    Chamber
module    Commands
describe  Secure do
  let(:rootpath)           { Pathname.new(::File.expand_path('./spec/fixtures')) }
  let(:settings_directory) { rootpath + 'settings' }
  let(:settings_filename)  { settings_directory + 'unencrypted.yml' }
  let(:options)            do
    {
      basepath:       rootpath,
      rootpath:       rootpath,
      encryption_key: rootpath + '../spec_key',
      shell:          double.as_null_object,
    }
  end

  before(:each) do
    ::FileUtils.mkdir_p settings_directory unless ::File.exist? settings_directory
  end

  after(:each) do
    ::FileUtils.rm_rf(settings_directory) if ::File.exist? settings_directory
  end

  it 'can return values formatted as environment variables' do
    settings_filename.write <<-HEREDOC
test:
  _secure_my_unencrpyted_setting: hello
HEREDOC

    Secure.call(options)

    expect(settings_filename.read).
    to match %r{_secure_my_unencrpyted_setting: [A-Za-z0-9\+\/]{342}==}
  end
end
end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chamber-2.10.1 spec/lib/chamber/commands/secure_spec.rb
chamber-2.10.0 spec/lib/chamber/commands/secure_spec.rb
chamber-2.9.1 spec/lib/chamber/commands/secure_spec.rb
chamber-2.9.0 spec/lib/chamber/commands/secure_spec.rb