Sha256: 5031024adfd0c58942c2e75c2d71226125cc20964a0623f7e1e59bdf0140c7dc

Contents?: true

Size: 620 Bytes

Versions: 8

Compression:

Stored size: 620 Bytes

Contents

require 'spec_helper'

describe Hashie::Extensions::Parsers::YamlErbParser do
  describe '.perform' do
    let(:config) do
      <<-EOF
---
foo: verbatim
bar: <%= "erb" %>
baz: "<%= __FILE__ %>"
      EOF
    end
    let(:path) { 'template.yml' }

    subject { described_class.new(path).perform }

    before do
      expect(File).to receive(:read).with(path).and_return(config)
    end

    it { is_expected.to be_a(Hash) }

    it 'parses YAML after interpolating ERB' do
      expect(subject['foo']).to eq 'verbatim'
      expect(subject['bar']).to eq 'erb'
      expect(subject['baz']).to eq path
    end
  end
end

Version data entries

8 entries across 7 versions & 2 rubygems

Version Path
hashie-3.4.4 spec/hashie/parsers/yaml_erb_parser_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/hashie-3.4.3/spec/hashie/parsers/yaml_erb_parser_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/hashie-3.4.3/spec/hashie/parsers/yaml_erb_parser_spec.rb
hashie-3.4.3 spec/hashie/parsers/yaml_erb_parser_spec.rb
hashie-3.4.2 spec/hashie/parsers/yaml_erb_parser_spec.rb
hashie-3.4.1 spec/hashie/parsers/yaml_erb_parser_spec.rb
hashie-3.4.0 spec/hashie/parsers/yaml_erb_parser_spec.rb
hashie-3.3.2 spec/hashie/parsers/yaml_erb_parser_spec.rb