add test for PGP key yaml frontmatter

This commit is contained in:
Ben Balter 2014-04-06 16:03:19 -04:00
parent 823c863a53
commit 6c0f40385c
3 changed files with 13 additions and 0 deletions

2
test/source/pgp.key Normal file
View File

@ -0,0 +1,2 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)

View File

@ -48,6 +48,7 @@ class TestGeneratedSite < Test::Unit::TestCase
should "print a nice list of static files" do
expected_output = Regexp.new <<-OUTPUT
- /css/screen.css last edited at \\d+ with extname .css
- /pgp.key last edited at \\d+ with extname .key
- /products.yml last edited at \\d+ with extname .yml
- /symlink-test/symlinked-dir/screen.css last edited at \\d+ with extname .css
OUTPUT

View File

@ -187,6 +187,16 @@ class TestSite < Test::Unit::TestCase
assert_equal posts.size - @num_invalid_posts, @site.posts.size
end
should "read pages with yaml front matter" do
abs_path = File.expand_path("about.html", @site.source)
assert_equal true, @site.send(:has_yaml_header?, abs_path)
end
should "not read PGP keys as pages" do
abs_path = File.expand_path("pgp.key", @site.source)
assert_equal false, @site.send(:has_yaml_header?, abs_path)
end
should "expose jekyll version to site payload" do
assert_equal Jekyll::VERSION, @site.site_payload['jekyll']['version']
end