find keys also in assigned collections

This commit is contained in:
Florian Thomas 2016-09-22 22:14:14 +03:00 提交者 Parker Moore
父節點 dbea1ca80b
當前提交 dde0441b3a
沒有發現已知的金鑰在資料庫的簽署中
GPG 金鑰 ID: 193CDEBA72063C58
共有 2 個檔案被更改,包括 25 行新增0 行删除

查看文件

@ -19,6 +19,10 @@ module Jekyll
end
end
def key?(key)
(@obj.collections.key?(key) && key != "posts") || super
end
def posts
@site_posts ||= @obj.posts.docs.sort { |a, b| b <=> a }
end

21
test/test_site_drop.rb Normal file
查看文件

@ -0,0 +1,21 @@
require "helper"
class TestSiteDrop < JekyllUnitTest
context "a site drop" do
setup do
@site = fixture_site({
"collections" => ["thanksgiving"]
})
@site.process
@drop = @site.to_liquid.site
end
should "respond to `key?`" do
assert @drop.respond_to?(:key?)
end
should "find a key if it's in the collection of the drop" do
assert @drop.key?("thanksgiving")
end
end
end