Sha256: 63745af5334e185bad0d334e76789ee6394f27c732fd50d4e7cadf0248dee18e

Contents?: true

Size: 1.03 KB

Versions: 69

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require 'eac_config/old_configs'
require 'eac_templates/file'

RSpec.describe ::EacTemplates::File do
  let(:files_dir) { ::File.join(__dir__, 'file_spec_files') }
  let(:source_path) { ::File.join(files_dir, 'source.template') }
  let(:instance) { described_class.new(source_path) }
  let(:expected_content) { ::File.read(::File.join(files_dir, 'expected_content')) }

  describe '#apply' do
    context 'when config is a hash' do
      let(:config) { { name: 'Fulano de Tal', age: 33 } }

      it { expect(instance.apply(config)).to eq(expected_content) }
    end

    context 'when config responds to read_entry' do
      let(:config) { ::EacConfig::OldConfigs.new('rspec_describe_eac_ruby_utils_templates_file') }

      before do
        config.clear
        config['name'] = 'Fulano de Tal'
        config['age'] = '33'
      end

      it { expect(instance.apply(config)).to eq(expected_content) }
    end
  end

  describe '#variables' do
    it { expect(instance.variables).to eq(::Set.new(%w[name age])) }
  end
end

Version data entries

69 entries across 69 versions & 3 rubygems

Version Path
avm-tools-0.129.0 sub/eac_templates/spec/lib/eac_templates/file_spec.rb
eac_tools-0.16.0 sub/avm-tools/sub/eac_templates/spec/lib/eac_templates/file_spec.rb
avm-tools-0.128.0 sub/eac_templates/spec/lib/eac_templates/file_spec.rb
eac_tools-0.15.0 sub/avm-tools/sub/eac_templates/spec/lib/eac_templates/file_spec.rb
eac_tools-0.14.0 sub/avm-tools/sub/eac_templates/spec/lib/eac_templates/file_spec.rb
eac_tools-0.13.0 sub/avm-tools/sub/eac_templates/spec/lib/eac_templates/file_spec.rb
avm-tools-0.127.0 sub/eac_templates/spec/lib/eac_templates/file_spec.rb
eac_tools-0.12.0 sub/avm-tools/sub/eac_templates/spec/lib/eac_templates/file_spec.rb
avm-tools-0.126.0 sub/eac_templates/spec/lib/eac_templates/file_spec.rb
eac_tools-0.11.1 sub/avm-tools/sub/eac_templates/spec/lib/eac_templates/file_spec.rb
avm-tools-0.125.0 sub/eac_templates/spec/lib/eac_templates/file_spec.rb
eac_tools-0.11.0 sub/avm-tools/sub/eac_templates/spec/lib/eac_templates/file_spec.rb
avm-tools-0.124.0 sub/eac_templates/spec/lib/eac_templates/file_spec.rb
eac_tools-0.10.0 sub/avm-tools/sub/eac_templates/spec/lib/eac_templates/file_spec.rb
avm-tools-0.123.0 sub/eac_templates/spec/lib/eac_templates/file_spec.rb
eac_tools-0.9.0 sub/avm-tools/sub/eac_templates/spec/lib/eac_templates/file_spec.rb
avm-tools-0.122.0 sub/eac_templates/spec/lib/eac_templates/file_spec.rb
eac_tools-0.8.0 sub/avm-tools/sub/eac_templates/spec/lib/eac_templates/file_spec.rb
eac_tools-0.7.0 sub/avm-tools/sub/eac_templates/spec/lib/eac_templates/file_spec.rb
eac_tools-0.6.0 sub/avm-tools/sub/eac_templates/spec/lib/eac_templates/file_spec.rb