Sha256: 87274c67c86610bd7becdf893896e8c0c90d6eadaf13c2fb6b13a39af692af7a

Contents?: true

Size: 571 Bytes

Versions: 2

Compression:

Stored size: 571 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 whitelisted classes' do
      string = 'timestamp: 2017-10-17 00:00:00Z'
      params = { whitelist_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-0.2.1 spec/front_matter_parser/loader/yaml_spec.rb
front_matter_parser-0.2.0 spec/front_matter_parser/loader/yaml_spec.rb