diff --git a/lib/jekyll/drops/site_drop.rb b/lib/jekyll/drops/site_drop.rb index 66366810..97b41806 100644 --- a/lib/jekyll/drops/site_drop.rb +++ b/lib/jekyll/drops/site_drop.rb @@ -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 diff --git a/test/test_site_drop.rb b/test/test_site_drop.rb new file mode 100644 index 00000000..6175bbb8 --- /dev/null +++ b/test/test_site_drop.rb @@ -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