find keys also in assigned collections
This commit is contained in:
parent
dbea1ca80b
commit
dde0441b3a
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue