Sha256: 1ff7f4b6258a97eaa68d7c2d8735bf5037dafeece006267362f9dbe7849866cb

Contents?: true

Size: 574 Bytes

Versions: 2

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe FrontMatterParser::Loader::Yaml do
  describe '#call' do
    it 'loads using yaml parser' do
      string = "title: 'hello'"

      expect(described_class.new.call(string)).to eq(
        'title' => 'hello'
      )
    end

    it 'loads with classes in allowlist' do
      string = 'timestamp: 2017-10-17 00:00:00Z'
      params = { allowlist_classes: [Time] }

      expect(described_class.new(**params).call(string)).to eq(
        'timestamp' => Time.parse('2017-10-17 00:00:00Z')
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
front_matter_parser-1.0.1 spec/front_matter_parser/loader/yaml_spec.rb
front_matter_parser-1.0.0 spec/front_matter_parser/loader/yaml_spec.rb