From d2b1d538bf402809753c981548a9ec8f6c7b7b44 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 24 Apr 2014 14:07:08 -0400 Subject: [PATCH] Add test for collections' new #to_liquid sturff --- test/test_collections.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/test_collections.rb b/test/test_collections.rb index 8dbc397d..dafc2a8f 100644 --- a/test/test_collections.rb +++ b/test/test_collections.rb @@ -49,6 +49,35 @@ class TestCollections < Test::Unit::TestCase should "know the full path to itself on the filesystem" do assert_equal @collection.directory, source_dir("_methods") end + + context "when turned into Liquid" do + should "have a label attribute" do + assert_equal @collection.to_liquid["label"], "methods" + end + + should "have a docs attribute" do + assert_equal @collection.to_liquid["docs"], Array.new + end + + should "have a directory attribute" do + assert_equal @collection.to_liquid["directory"], source_dir("_methods") + end + + should "have a relative_directory attribute" do + assert_equal @collection.to_liquid["relative_directory"], "_methods" + end + + should "have a written attribute" do + assert_equal @collection.to_liquid["written"], false + end + end + + should "know whether it should be written or not" do + assert_equal @collection.write?, false + @collection.metadata['write'] = true + assert_equal @collection.write?, true + @collection.metadata.delete 'write' + end end context "with no collections specified" do