mirror of
https://github.com/jekyll/jekyll.git
synced 2026-02-01 02:05:35 -05:00
It's the theme of the moment ; regexp checking. Just in case we have two line start with --- in the file, we want to make sure it's not interpreted as a front-matter.
23 lines
632 B
Ruby
23 lines
632 B
Ruby
require 'helper'
|
|
require 'ostruct'
|
|
|
|
class TestConvertible < Test::Unit::TestCase
|
|
context "yaml front-matter" do
|
|
setup do
|
|
@convertible = OpenStruct.new
|
|
@convertible.extend Jekyll::Convertible
|
|
@base = File.expand_path('../fixtures', __FILE__)
|
|
end
|
|
|
|
should "parse the front-matter correctly" do
|
|
ret = @convertible.read_yaml(@base, 'front_matter.erb')
|
|
assert_equal({'test' => 'good'}, ret)
|
|
end
|
|
|
|
should "not parse if the front-matter is not at the start of the file" do
|
|
ret = @convertible.read_yaml(@base, 'broken_front_matter1.erb')
|
|
assert_equal({}, ret)
|
|
end
|
|
end
|
|
end
|