diff --git a/features/include_tag.feature b/features/include_tag.feature new file mode 100644 index 00000000..9d301fcd --- /dev/null +++ b/features/include_tag.feature @@ -0,0 +1,30 @@ +Feature: Include tags + In order to share their content across several pages + As a hacker who likes to blog + I want to be able to include files in my blog posts + + Scenario: Include a file with parameters + Given I have an _includes directory + And I have an "_includes/header.html" file that contains "
My awesome blog header: {{include.param}}
" + And I have an "_includes/params.html" file that contains "Parameters:" + And I have an "_includes/ignore.html" file that contains "" + And I have a _posts directory + And I have the following post: + | title | date | layout | content | + | Include Files | 3/21/2013 | default | {% include header.html param="myparam" %} | + | Ignore params if unused | 3/21/2013 | default | {% include ignore.html date="today" %} | + | List multiple parameters | 3/21/2013 | default | {% include params.html date="today" start="tomorrow" %} | + | Dont keep parameters | 3/21/2013 | default | {% include ignore.html param="test" %}\n{% include header.html %} | + | Allow params with spaces and quotes | 4/07/2013 | default | {% include params.html cool="param with spaces" super="\"quoted\"" %} | + | Parameter syntax | 4/12/2013 | default | {% include params.html param1_or_2="value" %} | + When I run jekyll + Then the _site directory should exist + And I should see "
My awesome blog header: myparam
" in "_site/2013/03/21/include-files.html" + And I should not see "myparam" in "_site/2013/03/21/ignore-params-if-unused.html" + And I should see "
  • date = today
  • " in "_site/2013/03/21/list-multiple-parameters.html" + And I should see "
  • start = tomorrow
  • " in "_site/2013/03/21/list-multiple-parameters.html" + And I should not see "
    My awesome blog header: myparam
    " in "_site/2013/03/21/dont-keep-parameters.html" + But I should see "
    My awesome blog header:
    " in "_site/2013/03/21/dont-keep-parameters.html" + And I should see "
  • cool = param with spaces
  • " in "_site/2013/04/07/allow-params-with-spaces-and-quotes.html" + And I should see "
  • super = “quoted”
  • " in "_site/2013/04/07/allow-params-with-spaces-and-quotes.html" + And I should see "
  • param1_or_2 = value
  • " in "_site/2013/04/12/parameter-syntax.html" diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 7a1c7cd1..293bc2eb 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -136,6 +136,10 @@ Then /^I should see "(.*)" in "(.*)"$/ do |text, file| assert Regexp.new(text).match(File.open(file).readlines.join) end +Then /^I should not see "(.*)" in "(.*)"$/ do |text, file| + assert_no_match Regexp.new(text), File.read(file) +end + Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file| assert Regexp.new(Regexp.escape(text)).match(File.open(file).readlines.join) end