Sha256: fa91e76debe36eaf95efde859b4831ab42d7927532849fe29e96375d46523f6b

Contents?: true

Size: 1.04 KB

Versions: 170

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require 'tempfile'
require 'eac_config/old_configs'

RSpec.describe ::EacConfig::OldConfigs do
  let(:configs_key) { 'configsspec' }
  let(:storage_path) do
    file = ::Tempfile.new(configs_key)
    path = file.path
    file.close
    file.unlink
    path
  end
  let(:instance) { described_class.new(configs_key, storage_path: storage_path) }

  describe '#storage_path' do
    it { expect(instance.storage_path).to eq(storage_path) }
  end

  describe '#write' do
    let(:entry_key) { 'parent.child' }

    before do
      instance[entry_key] = 'value1'
      instance.save
    end

    it { expect(::YAML.load_file(storage_path)).to eq(parent: { child: 'value1' }) }
  end

  describe '#read' do
    let(:present_key) { 'a.present.key' }
    let(:blank_key) { 'a.blank.key' }

    before do
      instance[present_key] = 'A value'
      instance[blank_key] = ''
      instance.save
      instance.load
    end

    it { expect(instance[present_key]).to be_present }
    it { expect(instance[blank_key]).to be_present }
  end
end

Version data entries

170 entries across 170 versions & 3 rubygems

Version Path
eac_tools-0.82.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.81.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.80.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.79.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.78.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.77.1 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.77.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.76.1 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.76.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.75.2 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.75.1 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.75.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.74.1 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.74.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.73.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.72.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.70.1 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.70.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.69.1 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb
eac_tools-0.69.0 sub/eac_config/spec/lib/eac_config/old_configs_spec.rb