From 83f726f503c292a266c590b883aee2c6b84b508d Mon Sep 17 00:00:00 2001 From: Ivan Tse Date: Tue, 5 Aug 2014 01:03:28 -0400 Subject: [PATCH] Add tests for include tag with partial variables --- features/include_tag.feature | 11 +++++++++++ .../2013-12-17-include-variable-filters.markdown | 4 ++++ test/test_tags.rb | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/features/include_tag.feature b/features/include_tag.feature index 3d2f48c2..22a83480 100644 --- a/features/include_tag.feature +++ b/features/include_tag.feature @@ -66,3 +66,14 @@ Feature: Include tags When I run jekyll build Then the _site directory should exist And I should see "one included" in "_site/index.html" + + Scenario: Include a file with partial variables + Given I have an _includes directory + And I have an "_includes/one.html" file that contains "one included" + And I have a configuration file with: + | key | value | + | include_file | one | + And I have an "index.html" page that contains "{% include {{ site.include_file }}.html %}" + When I run jekyll build + Then the _site directory should exist + And I should see "one included" in "_site/index.html" diff --git a/test/source/_posts/2013-12-17-include-variable-filters.markdown b/test/source/_posts/2013-12-17-include-variable-filters.markdown index 3d66e879..c3291c7c 100644 --- a/test/source/_posts/2013-12-17-include-variable-filters.markdown +++ b/test/source/_posts/2013-12-17-include-variable-filters.markdown @@ -5,6 +5,7 @@ include1: include.html include2: include include3: INCLUDE include4: params +include5: clude --- Liquid tests @@ -19,3 +20,6 @@ Whitespace tests Parameters test - 7 {% include {{ page.include4 | append: '.html' }} var1='foo' var2='bar' %} + +Partial variable test +- 8 {% include in{{ page.include5 }}.html %} diff --git a/test/test_tags.rb b/test/test_tags.rb index 942b28ce..815f14d5 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -504,6 +504,10 @@ CONTENT assert_match '
  • var1 = foo
  • ', @content assert_match '
  • var2 = bar
  • ', @content end + + should "include file as partial variable" do + assert_match %r{8 included}, @content + end end end end