diff --git a/features/collections.feature b/features/collections.feature index 1fcc7cce..888bd1c2 100644 --- a/features/collections.feature +++ b/features/collections.feature @@ -8,7 +8,8 @@ Feature: Collections And I have fixture collections And I have a configuration file with "collections" set to "['methods']" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Collections:

Use Jekyll.configuration to build a full configuration for use w/Jekyll.

\n\n

Whatever: foo.bar

\n

Signs are nice

\n

Jekyll.sanitized_path is used to make sure your path is in your source.

\n

Run your generators! default

\n

Page without title.

\n

Run your generators! default

" in "_site/index.html" And the "_site/methods/configuration.html" file should not exist @@ -24,7 +25,8 @@ Feature: Collections foo: bar """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Collections: output => true" in "_site/index.html" And I should see "label => methods" in "_site/index.html" And I should see "Methods metadata: bar" in "_site/collection_metadata.html" @@ -41,7 +43,8 @@ Feature: Collections permalink: /:collection/:path/ """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "

Whatever: foo.bar

" in "_site/methods/configuration/index.html" Scenario: Rendered document in a layout @@ -56,7 +59,8 @@ Feature: Collections foo: bar """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Collections: output => true" in "_site/index.html" And I should see "label => methods" in "_site/index.html" And I should see "foo => bar" in "_site/index.html" @@ -72,7 +76,8 @@ Feature: Collections - methods """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Collections: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html" Scenario: Collections specified as an hash @@ -84,7 +89,8 @@ Feature: Collections - methods """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Collections: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html" Scenario: All the documents @@ -96,7 +102,8 @@ Feature: Collections - methods """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "All documents: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html" Scenario: Documents have an output attribute, which is the converted HTML @@ -108,7 +115,8 @@ Feature: Collections - methods """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "First document's output:

Use Jekyll.configuration to build a full configuration for use w/Jekyll.

\n\n

Whatever: foo.bar

" in "_site/index.html" Scenario: Filter documents by where @@ -120,7 +128,8 @@ Feature: Collections - methods """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Item count: 2" in "_site/index.html" Scenario: Sort by title @@ -132,7 +141,8 @@ Feature: Collections - methods """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "1. of 7:

Page without title.

" in "_site/index.html" Scenario: Sort by relative_path @@ -144,5 +154,6 @@ Feature: Collections - methods """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Collections: Jekyll.configuration, Jekyll.escape, Jekyll.sanitized_path, Site#generate, , Site#generate," in "_site/index.html" diff --git a/features/create_sites.feature b/features/create_sites.feature index 898115c2..031fa434 100644 --- a/features/create_sites.feature +++ b/features/create_sites.feature @@ -13,7 +13,8 @@ Feature: Create sites Scenario: Basic site Given I have an "index.html" file that contains "Basic Site" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Basic Site" in "_site/index.html" Scenario: Basic site with a post @@ -22,7 +23,8 @@ Feature: Create sites | title | date | content | | Hackers | 2009-03-27 | My First Exploit | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "My First Exploit" in "_site/2009/03/27/hackers.html" Scenario: Basic site with layout and a page @@ -30,7 +32,8 @@ Feature: Create sites And I have an "index.html" page with layout "default" that contains "Basic Site with Layout" And I have a default layout that contains "Page Layout: {{ content }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Page Layout: Basic Site with Layout" in "_site/index.html" Scenario: Basic site with layout and a post @@ -41,7 +44,8 @@ Feature: Create sites | Wargames | 2009-03-27 | default | The only winning move is not to play. | And I have a default layout that contains "Post Layout: {{ content }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post Layout:

The only winning move is not to play.

" in "_site/2009/03/27/wargames.html" Scenario: Basic site with layout inside a subfolder and a post @@ -52,7 +56,8 @@ Feature: Create sites | Wargames | 2009-03-27 | post/simple | The only winning move is not to play. | And I have a post/simple layout that contains "Post Layout: {{ content }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post Layout:

The only winning move is not to play.

" in "_site/2009/03/27/wargames.html" Scenario: Basic site with layouts, pages, posts and files @@ -75,7 +80,8 @@ Feature: Create sites | entry3 | 2009-05-27 | post | content for entry3. | | entry4 | 2009-06-27 | post | content for entry4. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Page : Site contains 2 pages and 4 posts" in "_site/index.html" And I should see "No replacement \{\{ site.posts.size \}\}" in "_site/about.html" And I should see "" in "_site/another_file" @@ -90,7 +96,8 @@ Feature: Create sites And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}" And I have an "_includes/about.textile" file that contains "Generated by Jekyll" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html" Scenario: Basic site with subdir include tag @@ -99,7 +106,8 @@ Feature: Create sites And I have an info directory And I have an "info/index.html" page that contains "Basic Site with subdir include tag: {% include about.textile %}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Basic Site with subdir include tag: Generated by Jekyll" in "_site/info/index.html" Scenario: Basic site with nested include tag @@ -108,7 +116,8 @@ Feature: Create sites And I have an "_includes/jekyll.textile" file that contains "Jekyll" And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html" Scenario: Basic site with internal post linking @@ -120,19 +129,22 @@ Feature: Create sites | entry1 | 2007-12-31 | post | content for entry1. | | entry2 | 2008-01-01 | post | content for entry2. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "URL: /2008/01/01/entry2/" in "_site/index.html" Scenario: Basic site with whitelisted dotfile Given I have an ".htaccess" file that contains "SomeDirective" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "SomeDirective" in "_site/.htaccess" Scenario: File was replaced by a directory Given I have a "test" file that contains "some stuff" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist When I delete the file "test" Given I have a test directory And I have a "test/index.html" file that contains "some other stuff" @@ -146,13 +158,15 @@ Feature: Create sites And I have a "secret.html" page with published "false" that contains "Unpublished page" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the "_site/index.html" file should exist And the "_site/public.html" file should exist But the "_site/secret.html" file should not exist When I run jekyll build --unpublished - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the "_site/index.html" file should exist And the "_site/public.html" file should exist And the "_site/secret.html" file should exist @@ -164,9 +178,11 @@ Feature: Create sites | entry1 | 2020-12-31 | post | content for entry1. | | entry2 | 2007-12-31 | post | content for entry2. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "content for entry2" in "_site/2007/12/31/entry2.html" And the "_site/2020/12/31/entry1.html" file should not exist When I run jekyll build --future - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the "_site/2020/12/31/entry1.html" file should exist diff --git a/features/drafts.feature b/features/drafts.feature index 5d7982ec..5a7f49f3 100644 --- a/features/drafts.feature +++ b/features/drafts.feature @@ -10,7 +10,8 @@ Feature: Draft Posts | title | date | layout | content | | Recipe | 2009-03-27 | default | Not baked yet. | When I run jekyll build --drafts - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Not baked yet." in "_site/recipe.html" Scenario: Don't preview a draft @@ -21,7 +22,8 @@ Feature: Draft Posts | title | date | layout | content | | Recipe | 2009-03-27 | default | Not baked yet. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the "_site/recipe.html" file should not exist Scenario: Don't preview a draft that is not published @@ -32,7 +34,8 @@ Feature: Draft Posts | title | date | layout | published | content | | Recipe | 2009-03-27 | default | false | Not baked yet. | When I run jekyll build --drafts - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the "_site/recipe.html" file should not exist Scenario: Use page.path variable @@ -42,5 +45,6 @@ Feature: Draft Posts | title | date | layout | content | | Recipe | 2009-03-27 | simple | Post path: {{ page.path }} | When I run jekyll build --drafts - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post path: _drafts/recipe.markdown" in "_site/recipe.html" diff --git a/features/embed_filters.feature b/features/embed_filters.feature index d6f99fc7..e3802fe5 100644 --- a/features/embed_filters.feature +++ b/features/embed_filters.feature @@ -11,7 +11,8 @@ Feature: Embed filters | Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. | And I have a default layout that contains "{{ site.time | date_to_xmlschema }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see today's date in "_site/2009/03/27/star-wars.html" Scenario: Escape text for XML @@ -22,7 +23,8 @@ Feature: Embed filters | Star & Wars | 2009-03-27 | default | These aren't the droids you're looking for. | And I have a default layout that contains "{{ page.title | xml_escape }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Star & Wars" in "_site/2009/03/27/star-wars.html" Scenario: Calculate number of words @@ -33,7 +35,8 @@ Feature: Embed filters | Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. | And I have a default layout that contains "{{ content | number_of_words }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "7" in "_site/2009/03/27/star-wars.html" Scenario: Convert an array into a sentence @@ -44,7 +47,8 @@ Feature: Embed filters | Star Wars | 2009-03-27 | default | [scifi, movies, force] | These aren't the droids you're looking for. | And I have a default layout that contains "{{ page.tags | array_to_sentence_string }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "scifi, movies, and force" in "_site/2009/03/27/star-wars.html" Scenario: Markdownify a given string @@ -55,7 +59,8 @@ Feature: Embed filters | Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. | And I have a default layout that contains "By {{ '_Obi-wan_' | markdownify }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "By

Obi-wan

" in "_site/2009/03/27/star-wars.html" Scenario: Sort by an arbitrary variable @@ -68,38 +73,37 @@ Feature: Embed filters | Page-2 | default | 6 | Something | And I have a default layout that contains "{{ site.pages | sort:'value' | map:'title' | join:', ' }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see exactly "Page-2, Page-1" in "_site/page-1.html" And I should see exactly "Page-2, Page-1" in "_site/page-2.html" Scenario: Sort pages by the title Given I have a _layouts directory + And I have the following pages: + | title | layout | content | + | Dog | default | Run | + | Bird | default | Fly | And I have the following page: - | title | layout | content | - | Dog | default | Run | - And I have the following page: - | title | layout | content | - | Bird | default | Fly | - And I have the following page: - | layout | content | - | default | Jump | + | layout | content | + | default | Jump | And I have a default layout that contains "{% assign sorted_pages = site.pages | sort: 'title' %}The rule of {{ sorted_pages.size }}: {% for p in sorted_pages %}{{ p.content | strip_html | strip_newlines }}, {% endfor %}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see exactly "The rule of 3: Jump, Fly, Run," in "_site/bird.html" Scenario: Sort pages by the title ordering pages without title last Given I have a _layouts directory + And I have the following pages: + | title | layout | content | + | Dog | default | Run | + | Bird | default | Fly | And I have the following page: - | title | layout | content | - | Dog | default | Run | - And I have the following page: - | title | layout | content | - | Bird | default | Fly | - And I have the following page: - | layout | content | - | default | Jump | + | layout | content | + | default | Jump | And I have a default layout that contains "{% assign sorted_pages = site.pages | sort: 'title', 'last' %}The rule of {{ sorted_pages.size }}: {% for p in sorted_pages %}{{ p.content | strip_html | strip_newlines }}, {% endfor %}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see exactly "The rule of 3: Fly, Run, Jump," in "_site/bird.html" diff --git a/features/frontmatter_defaults.feature b/features/frontmatter_defaults.feature index a9a64ae2..31aee377 100644 --- a/features/frontmatter_defaults.feature +++ b/features/frontmatter_defaults.feature @@ -12,7 +12,8 @@ Feature: frontmatter defaults And I have a configuration file with "defaults" set to "[{scope: {path: ""}, values: {layout: "pretty"}}]" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "THIS IS THE LAYOUT:

just some post

" in "_site/2013/09/11/default-layout.html" And I should see "THIS IS THE LAYOUT: just some page" in "_site/index.html" @@ -24,7 +25,8 @@ Feature: frontmatter defaults And I have an "index.html" page that contains "just {{page.custom}} by {{page.author}}" And I have a configuration file with "defaults" set to "[{scope: {path: ""}, values: {custom: "some special data", author: "Ben"}}]" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "

some special data

\n
Ben
" in "_site/2013/09/11/default-data.html" And I should see "just some special data by Ben" in "_site/index.html" @@ -48,7 +50,8 @@ Feature: frontmatter defaults And I have a configuration file with "defaults" set to "[{scope: {path: "special"}, values: {layout: "subfolder", description: "the special section"}}, {scope: {path: ""}, values: {layout: "root", description: "the webpage"}}]" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "root:

info on the webpage

" in "_site/2013/10/14/about.html" And I should see "subfolder:

info on the special section

" in "_site/special/2013/10/14/about.html" And I should see "root: Overview for the webpage" in "_site/index.html" @@ -71,7 +74,8 @@ Feature: frontmatter defaults And I have a configuration file with "defaults" set to "[{scope: {path: "special"}, values: {layout: "main"}}, {scope: {path: "special/_posts"}, values: {layout: "main"}}, {scope: {path: "_posts"}, values: {layout: "main"}}]" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "main:

content of site/2013/10/14/about.html

" in "_site/2013/10/14/about.html" And I should see "main:

content of site/special/2013/10/14/about1.html

" in "_site/special/2013/10/14/about1.html" And I should see "main:

content of site/special/2013/10/14/about2.html

" in "_site/special/2013/10/14/about2.html" @@ -132,7 +136,8 @@ Feature: frontmatter defaults myval: "Test" """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Value: Test" in "_site/slides/slide1.html" Scenario: Override frontmatter defaults inside a collection @@ -159,7 +164,8 @@ Feature: frontmatter defaults myval: "Test" """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Value: Override" in "_site/slides/slide2.html" Scenario: Deep merge frontmatter defaults diff --git a/features/hooks.feature b/features/hooks.feature index 5252d562..48b2884e 100644 --- a/features/hooks.feature +++ b/features/hooks.feature @@ -24,7 +24,8 @@ Feature: Hooks end """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "mytinypage" in "_site/foo.html" Scenario: Modify the payload before rendering the site @@ -37,7 +38,8 @@ Feature: Hooks end """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "myparam!" in "_site/index.html" Scenario: Modify the site contents after reading @@ -51,7 +53,8 @@ Feature: Hooks end """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the "_site/page1.html" file should not exist And I should see "page2" in "_site/page2.html" @@ -67,7 +70,8 @@ Feature: Hooks """ And I have a "page1.html" page that contains "page1" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "page1" in "_site/firstpage.html" Scenario: Alter a page right after it is initialized @@ -81,7 +85,8 @@ Feature: Hooks """ And I have a "page1.html" page that contains "page1" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "page1" in "_site/renamed.html" Scenario: Alter the payload for one page but not another @@ -138,7 +143,8 @@ Feature: Hooks | title | date | layout | content | | entry1 | 2015-03-14 | nil | {{ page.harold }} | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "pbagrag sbe ragel1." in "_site/2015/03/14/entry1.html" Scenario: Alter the payload for certain posts @@ -268,7 +274,8 @@ Feature: Hooks {{ site.memes.first.text }} """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "all your base are belong to us" in "_site/index.html" Scenario: Update a document after rendering it, but before writing it to disk @@ -294,7 +301,8 @@ Feature: Hooks {{ page.text }} """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "

all your base are belong to us" in "_site/memes/doc1.html" Scenario: Perform an action after every document is written @@ -322,5 +330,6 @@ Feature: Hooks {{ page.text }} """ When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Wrote document 0" in "_site/document-build.log" diff --git a/features/include_tag.feature b/features/include_tag.feature index 83ae379f..c8ebf717 100644 --- a/features/include_tag.feature +++ b/features/include_tag.feature @@ -19,7 +19,8 @@ Feature: Include tags | Parameter syntax | 2013-04-12 | html | {% include params.html param1_or_2="value" %} | | Pass a variable | 2013-06-22 | html | {% assign var = 'some text' %}{% include params.html local=var title=page.title %} | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And 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" @@ -44,7 +45,8 @@ Feature: Include tags | include_file2 | parametrized.html | And I have an "index.html" page that contains "{% include {{site.include_file1}} %} that {% include {{site.include_file2}} what='parameters' %}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "a snippet that works with parameters" in "_site/index.html" Scenario: Include a variable file in a loop @@ -53,7 +55,8 @@ Feature: Include tags And I have an "_includes/two.html" file that contains "two" And I have an "index.html" page with files "[one.html, two.html]" that contains "{% for file in page.files %}{% include {{file}} %} {% endfor %}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "one two" in "_site/index.html" Scenario: Include a file with variables and filters @@ -64,7 +67,8 @@ Feature: Include tags | include_file | one | And I have an "index.html" page that contains "{% include {{ site.include_file | append: '.html' }} %}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "one included" in "_site/index.html" Scenario: Include a file with partial variables @@ -75,7 +79,8 @@ Feature: Include tags | 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 + Then I should get a zero exit status + And the _site directory should exist And I should see "one included" in "_site/index.html" Scenario: Include a file and rebuild when include content is changed @@ -83,7 +88,8 @@ Feature: Include tags And I have an "_includes/one.html" file that contains "include" And I have an "index.html" page that contains "{% include one.html %}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "include" in "_site/index.html" When I wait 1 second Then I have an "_includes/one.html" file that contains "include content changed" @@ -95,5 +101,6 @@ Feature: Include tags And I have an "_includes/header-en.html" file that contains "include" And I have an "index.html" page that contains "{% assign name = 'header' %}{% assign locale = 'en' %}{% include {{name}}-{{locale}}.html %}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "include" in "_site/index.html" diff --git a/features/incremental_rebuild.feature b/features/incremental_rebuild.feature index fb95e0c5..128f5800 100644 --- a/features/incremental_rebuild.feature +++ b/features/incremental_rebuild.feature @@ -11,10 +11,12 @@ Feature: Incremental rebuild | Wargames | 2009-03-27 | default | The only winning move is not to play. | And I have a default layout that contains "Post Layout: {{ content }}" When I run jekyll build -I - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post Layout:

    The only winning move is not to play.

    " in "_site/2009/03/27/wargames.html" When I run jekyll build -I - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post Layout:

    The only winning move is not to play.

    " in "_site/2009/03/27/wargames.html" Scenario: Generate a metadata file @@ -25,12 +27,14 @@ Feature: Incremental rebuild Scenario: Rebuild when content is changed Given I have an "index.html" file that contains "Basic Site" When I run jekyll build -I - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Basic Site" in "_site/index.html" When I wait 1 second Then I have an "index.html" file that contains "Bacon Site" When I run jekyll build -I - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Bacon Site" in "_site/index.html" Scenario: Rebuild when layout is changed @@ -38,12 +42,14 @@ Feature: Incremental rebuild And I have an "index.html" page with layout "default" that contains "Basic Site with Layout" And I have a default layout that contains "Page Layout: {{ content }}" When I run jekyll build -I - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Page Layout: Basic Site with Layout" in "_site/index.html" When I wait 1 second Then I have a default layout that contains "Page Layout Changed: {{ content }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Page Layout Changed: Basic Site with Layout" in "_site/index.html" Scenario: Rebuild when an include is changed @@ -51,10 +57,12 @@ Feature: Incremental rebuild And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}" And I have an "_includes/about.textile" file that contains "Generated by Jekyll" When I run jekyll build -I - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html" When I wait 1 second Then I have an "_includes/about.textile" file that contains "Regenerated by Jekyll" When I run jekyll build -I - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Basic Site with include tag: Regenerated by Jekyll" in "_site/index.html" diff --git a/features/markdown.feature b/features/markdown.feature index c0eeb25d..3649a6d1 100644 --- a/features/markdown.feature +++ b/features/markdown.feature @@ -11,7 +11,8 @@ Feature: Markdown | title | date | content | type | | Hackers | 2009-03-27 | # My Title | markdown | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Index" in "_site/index.html" And I should see "

    My Title

    " in "_site/2009/03/27/hackers.html" And I should see "

    My Title

    " in "_site/index.html" @@ -27,6 +28,7 @@ Feature: Markdown | title | date | content | type | | Hackers | 2009-03-27 | # My Title | markdown | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Index" in "_site/index.html" And I should see "

    My Title

    " in "_site/index.html" diff --git a/features/permalinks.feature b/features/permalinks.feature index 74f2e409..ca0482fc 100644 --- a/features/permalinks.feature +++ b/features/permalinks.feature @@ -10,7 +10,8 @@ Feature: Fancy permalinks | None Permalink Schema | 2009-03-27 | Totally nothing. | And I have a configuration file with "permalink" set to "none" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Totally nothing." in "_site/none-permalink-schema.html" Scenario: Use pretty permalink schema @@ -20,7 +21,8 @@ Feature: Fancy permalinks | Pretty Permalink Schema | 2009-03-27 | Totally wordpress. | And I have a configuration file with "permalink" set to "pretty" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Totally wordpress." in "_site/2009/03/27/pretty-permalink-schema/index.html" Scenario: Use pretty permalink schema for pages @@ -29,7 +31,8 @@ Feature: Fancy permalinks And I have an "sitemap.xml" page that contains "Totally uhm, sitemap" And I have a configuration file with "permalink" set to "pretty" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Totally index" in "_site/index.html" And I should see "Totally awesome" in "_site/awesome/index.html" And I should see "Totally uhm, sitemap" in "_site/sitemap.xml" @@ -41,7 +44,8 @@ Feature: Fancy permalinks | Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. | And I have a configuration file with "permalink" set to "/blog/:year/:month/:day/:title/" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Totally custom." in "_site/blog/2009/03/27/custom-permalink-schema/index.html" Scenario: Use custom permalink schema with category @@ -51,7 +55,8 @@ Feature: Fancy permalinks | Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. | And I have a configuration file with "permalink" set to "/:categories/:title.html" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Totally custom." in "_site/stuff/custom-permalink-schema.html" Scenario: Use custom permalink schema with squished date @@ -61,7 +66,8 @@ Feature: Fancy permalinks | Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. | And I have a configuration file with "permalink" set to "/:month-:day-:year/:title.html" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html" Scenario: Use custom permalink schema with date and time @@ -74,7 +80,8 @@ Feature: Fancy permalinks | permalink | "/:year:month:day:hour:minute:second.html" | | timezone | UTC | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Totally custom." in "_site/20090327223107.html" Scenario: Use per-post permalink @@ -83,7 +90,8 @@ Feature: Fancy permalinks | title | date | permalink | content | | Some post | 2013-04-14 | /custom/posts/1/ | bla bla | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the _site/custom/posts/1 directory should exist And I should see "bla bla" in "_site/custom/posts/1/index.html" @@ -93,7 +101,8 @@ Feature: Fancy permalinks | title | date | permalink | content | | Some post | 2013-04-14 | /custom/posts/some.html | bla bla | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the _site/custom/posts directory should exist And I should see "bla bla" in "_site/custom/posts/some.html" @@ -102,7 +111,8 @@ Feature: Fancy permalinks And I have an "_posts/2009-03-27-Pretty-Permalink-Schema.md" page that contains "Totally wordpress" And I have a configuration file with "permalink" set to "pretty" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Totally wordpress." in "_site/2009/03/27/Pretty-Permalink-Schema/index.html" Scenario: Use custom permalink schema with cased file name @@ -110,7 +120,8 @@ Feature: Fancy permalinks And I have an "_posts/2009-03-27-Custom-Schema.md" page with title "Custom Schema" that contains "Totally awesome" And I have a configuration file with "permalink" set to "/:year/:month/:day/:slug/" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Totally awesome" in "_site/2009/03/27/custom-schema/index.html" Scenario: Use pretty permalink schema with title containing underscore @@ -118,5 +129,16 @@ Feature: Fancy permalinks And I have an "_posts/2009-03-27-Custom_Schema.md" page with title "Custom Schema" that contains "Totally awesome" And I have a configuration file with "permalink" set to "pretty" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Totally awesome" in "_site/2009/03/27/Custom_Schema/index.html" + + Scenario: Use a non-HTML file extension in the permalink + Given I have a _posts directory + And I have an "_posts/2016-01-18-i-am-php.md" page with permalink "/2016/i-am-php.php" that contains "I am PHP" + And I have a "i-am-also-php.md" page with permalink "/i-am-also-php.php" that contains "I am also PHP" + When I run jekyll build + Then I should get a zero exit status + And the _site directory should exist + And I should see "I am PHP" in "_site/2016/i-am-php.php" + And I should see "I am also PHP" in "_site/i-am-also-php.php" diff --git a/features/plugins.feature b/features/plugins.feature index a36c6c82..be01a4a9 100644 --- a/features/plugins.feature +++ b/features/plugins.feature @@ -6,7 +6,8 @@ Feature: Configuring and using plugins Given I have an "index.html" file that contains "Whatever" And I have a configuration file with "gems" set to "[jekyll_test_plugin]" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Whatever" in "_site/index.html" And I should see "this is a test" in "_site/test.txt" @@ -17,7 +18,8 @@ Feature: Configuring and using plugins | gems | [jekyll_test_plugin] | | whitelist | [] | When I run jekyll build --safe - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Whatever" in "_site/index.html" And the "_site/test.txt" file should not exist @@ -28,7 +30,8 @@ Feature: Configuring and using plugins | gems | [jekyll_test_plugin, jekyll_test_plugin_malicious] | | whitelist | [jekyll_test_plugin] | When I run jekyll build --safe - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Whatever" in "_site/index.html" And the "_site/test.txt" file should exist And I should see "this is a test" in "_site/test.txt" diff --git a/features/post_data.feature b/features/post_data.feature index 2792a829..3b4f3cf7 100644 --- a/features/post_data.feature +++ b/features/post_data.feature @@ -11,7 +11,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post title: {{ page.title }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post title: Star Wars" in "_site/2009/03/27/star-wars.html" Scenario: Use post.url variable @@ -22,7 +23,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post url: {{ page.url }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post url: /2009/03/27/star-wars.html" in "_site/2009/03/27/star-wars.html" Scenario: Use post.date variable @@ -33,7 +35,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post date: {{ page.date | date_to_string }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post date: 27 Mar 2009" in "_site/2009/03/27/star-wars.html" Scenario: Use post.id variable @@ -44,7 +47,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post id: {{ page.id }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post id: /2009/03/27/star-wars" in "_site/2009/03/27/star-wars.html" Scenario: Use post.content variable @@ -55,7 +59,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post content: {{ content }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post content:

    Luke, I am your father.

    " in "_site/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in a folder @@ -67,7 +72,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in a folder and has category in YAML @@ -79,7 +85,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | film | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post category: movies" in "_site/movies/film/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in a folder and has categories in YAML @@ -91,7 +98,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | [film, scifi] | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post category: movies" in "_site/movies/film/scifi/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in a folder and duplicated category is in YAML @@ -103,7 +111,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" Scenario: Use post.tags variable @@ -114,7 +123,8 @@ Feature: Post data | Star Wars | 2009-05-18 | simple | twist | Luke, I am your father. | And I have a simple layout that contains "Post tags: {{ page.tags }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post tags: twist" in "_site/2009/05/18/star-wars.html" Scenario: Use post.categories variable when categories are in folders @@ -127,7 +137,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when categories are in folders with mixed case @@ -140,7 +151,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post categories: scifi and Movies" in "_site/scifi/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in YAML @@ -151,7 +163,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when category is in YAML and is mixed-case @@ -162,7 +175,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | Movies | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post category: Movies" in "_site/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when categories are in YAML @@ -173,7 +187,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | ['scifi', 'movies'] | Luke, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when categories are in YAML and are duplicated @@ -184,7 +199,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | ['movies', 'movies'] | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" Scenario: Superdirectories of _posts applied to post.categories @@ -193,7 +209,8 @@ Feature: Post data And I have a _layouts directory And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" Scenario: Subdirectories of _posts not applied to post.categories @@ -202,7 +219,8 @@ Feature: Post data And I have a _layouts directory And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when categories are in YAML with mixed case @@ -214,7 +232,8 @@ Feature: Post data | Star Trek | 2013-03-17 | simple | ['SciFi', 'movies'] | Jean Luc, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post categories: scifi and Movies" in "_site/scifi/movies/2009/03/27/star-wars.html" And I should see "Post categories: SciFi and movies" in "_site/scifi/movies/2013/03/17/star-trek.html" @@ -224,7 +243,8 @@ Feature: Post data | title | type | date | content | | my-post | html | 2013-04-12 | Source path: {{ page.path }} | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Source path: _posts/2013-04-12-my-post.html" in "_site//2013/04/12/my-post.html" Examples: @@ -239,7 +259,8 @@ Feature: Post data | title | date | path | content | | override | 2013-04-12 | override-path.html | Non-custom path: {{ page.path }} | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Non-custom path: _posts/2013-04-12-override.markdown" in "_site/2013/04/12/override.html" Scenario: Disable a post from being published @@ -249,7 +270,8 @@ Feature: Post data | title | date | layout | published | content | | Star Wars | 2009-03-27 | simple | false | Luke, I am your father. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the "_site/2009/03/27/star-wars.html" file should not exist And I should see "Published!" in "_site/index.html" @@ -261,7 +283,8 @@ Feature: Post data | Star Wars | 2009-03-27 | simple | Darth Vader | Luke, I am your father. | And I have a simple layout that contains "Post author: {{ page.author }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Post author: Darth Vader" in "_site/2009/03/27/star-wars.html" Scenario: Previous and next posts title @@ -274,6 +297,7 @@ Feature: Post data | Terminator | 2009-05-27 | ordered | Arnold | Sayonara, baby | And I have a ordered layout that contains "Previous post: {{ page.previous.title }} and next post: {{ page.next.title }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "next post: Some like it hot" in "_site/2009/03/27/star-wars.html" And I should see "Previous post: Some like it hot" in "_site/2009/05/27/terminator.html" diff --git a/features/post_excerpts.feature b/features/post_excerpts.feature index c66c527b..7344000c 100644 --- a/features/post_excerpts.feature +++ b/features/post_excerpts.feature @@ -12,7 +12,8 @@ Feature: Post excerpts | title | date | layout | content | | entry1 | 2007-12-31 | post | content for entry1. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see exactly "

    content for entry1.

    " in "_site/index.html" Scenario: An excerpt from a post with a layout @@ -24,7 +25,8 @@ Feature: Post excerpts | title | date | layout | content | | entry1 | 2007-12-31 | post | content for entry1. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the _site/2007 directory should exist And the _site/2007/12 directory should exist And the _site/2007/12/31 directory should exist @@ -41,7 +43,8 @@ Feature: Post excerpts | title | date | layout | content | | entry1 | 2007-12-31 | post | content for entry1. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the _site/2007 directory should exist And the _site/2007/12 directory should exist And the _site/2007/12/31 directory should exist diff --git a/features/rendering.feature b/features/rendering.feature index 01507cb0..5031ef06 100644 --- a/features/rendering.feature +++ b/features/rendering.feature @@ -16,7 +16,8 @@ Feature: Rendering Given I have a "index.html" page with layout "simple" that contains "Hi there, Jekyll {{ jekyll.environment }}!" And I have a simple layout that contains "{{ content }}Ahoy, indeed!" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Hi there, Jekyll development!\nAhoy, indeed" in "_site/index.html" Scenario: Don't place asset files in layout @@ -25,7 +26,8 @@ Feature: Rendering And I have a configuration file with "gems" set to "[jekyll-coffeescript]" And I have a simple layout that contains "{{ content }}Ahoy, indeed!" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should not see "Ahoy, indeed!" in "_site/index.css" And I should not see "Ahoy, indeed!" in "_site/index.js" @@ -33,18 +35,21 @@ Feature: Rendering Given I have an "index.scss" page that contains ".foo-bar { color:{{site.color}}; }" And I have a configuration file with "color" set to "red" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see ".foo-bar {\n color: red; }" in "_site/index.css" Scenario: Not render liquid in CoffeeScript without explicitly including jekyll-coffeescript Given I have an "index.coffee" page with animal "cicada" that contains "hey='for {{page.animal}}'" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the "_site/index.js" file should not exist Scenario: Render liquid in CoffeeScript with jekyll-coffeescript enabled Given I have an "index.coffee" page with animal "cicada" that contains "hey='for {{page.animal}}'" And I have a configuration file with "gems" set to "[jekyll-coffeescript]" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "hey = 'for cicada';" in "_site/index.js" diff --git a/features/site_configuration.feature b/features/site_configuration.feature index 379cea4f..5c495356 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -8,7 +8,8 @@ Feature: Site configuration And I have an "_sourcedir/index.html" file that contains "Changing source directory" And I have a configuration file with "source" set to "_sourcedir" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Changing source directory" in "_site/index.html" Scenario: Change destination directory @@ -66,27 +67,31 @@ Feature: Site configuration Given I have an "index.markdown" page that contains "[Google](http://google.com)" And I have a configuration file with "markdown" set to "rdiscount" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Google" in "_site/index.html" Scenario: Use Kramdown for markup Given I have an "index.markdown" page that contains "[Google](http://google.com)" And I have a configuration file with "markdown" set to "kramdown" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Google" in "_site/index.html" Scenario: Use Redcarpet for markup Given I have an "index.markdown" page that contains "[Google](http://google.com)" And I have a configuration file with "markdown" set to "redcarpet" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Google" in "_site/index.html" Scenario: Highlight code with pygments Given I have an "index.html" page that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Hello world!" in "_site/index.html" And I should see "class=\"highlight\"" in "_site/index.html" @@ -94,7 +99,8 @@ Feature: Site configuration Given I have an "index.html" page that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}" And I have a configuration file with "highlighter" set to "rouge" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Hello world!" in "_site/index.html" And I should see "class=\"highlight\"" in "_site/index.html" @@ -122,7 +128,8 @@ Feature: Site configuration | entry1 | 2007-12-31 | post | content for entry1. | | entry2 | 2020-01-31 | post | content for entry2. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Page Layout: 1 on 2010-01-01" in "_site/index.html" And I should see "Post Layout:

    content for entry1.

    " in "_site/2007/12/31/entry1.html" And the "_site/2020/01/31/entry2.html" file should not exist @@ -142,7 +149,8 @@ Feature: Site configuration | entry1 | 2007-12-31 | post | content for entry1. | | entry2 | 2020-01-31 | post | content for entry2. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html" And I should see "Post Layout:

    content for entry1.

    " in "_site/2007/12/31/entry1.html" And I should see "Post Layout:

    content for entry2.

    " in "_site/2020/01/31/entry2.html" @@ -161,7 +169,8 @@ Feature: Site configuration | entry1 | 2013-04-09 23:22 -0400 | post | content for entry1. | | entry2 | 2013-04-10 03:14 -0400 | post | content for entry2. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Page Layout: 2" in "_site/index.html" And I should see "Post Layout:

    content for entry1.

    \n built at 2013-04-09T23:22:00-04:00" in "_site/2013/04/09/entry1.html" And I should see "Post Layout:

    content for entry2.

    \n built at 2013-04-10T03:14:00-04:00" in "_site/2013/04/10/entry2.html" @@ -180,7 +189,8 @@ Feature: Site configuration | entry1 | 2013-04-09 23:22 +0400 | post | content for entry1. | | entry2 | 2013-04-10 03:14 +0400 | post | content for entry2. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Page Layout: 2" in "_site/index.html" And the "_site/2013/04/09/entry1.html" file should exist And the "_site/2013/04/09/entry2.html" file should exist @@ -198,7 +208,8 @@ Feature: Site configuration | Oranges | 2009-04-01 | An article about oranges | | Bananas | 2009-04-05 | An article about bananas | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And the "_site/2009/04/05/bananas.html" file should exist And the "_site/2009/04/01/oranges.html" file should exist And the "_site/2009/03/27/apples.html" file should not exist @@ -211,7 +222,8 @@ Feature: Site configuration | .gitignore | | .foo | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see ".DS_Store" in "_site/.gitignore" And the "_site/.htaccess" file should not exist @@ -231,7 +243,8 @@ Feature: Site configuration | entry1 | 2007-12-31 | post | content for entry1. | | entry2 | 2020-01-31 | post | content for entry2. | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html" And I should see "Post Layout:

    content for entry1.

    " in "_site/2007/12/31/entry1.html" And I should see "Post Layout:

    content for entry2.

    " in "_site/2020/01/31/entry2.html" @@ -240,6 +253,7 @@ Feature: Site configuration Given I have an "index.html" page with layout "page" that contains "FOO" And I have a "_config.yml" file that contains "layouts: '../../../../../../../../../../../../../../usr/include'" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "FOO" in "_site/index.html" And I should not see " " in "_site/index.html" diff --git a/features/site_data.feature b/features/site_data.feature index a7fadf34..e3c99a64 100644 --- a/features/site_data.feature +++ b/features/site_data.feature @@ -6,14 +6,16 @@ Feature: Site data Scenario: Use page variable in a page Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@example.com" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Contact: email@example.com" in "_site/contact.html" Scenario Outline: Use page.path variable in a page Given I have a directory And I have a "" page that contains "Source path: {{ page.path }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Source path: " in "_site/" Examples: @@ -25,13 +27,15 @@ Feature: Site data Scenario: Override page.path Given I have an "override.html" page with path "custom-override.html" that contains "Custom path: {{ page.path }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Custom path: custom-override.html" in "_site/override.html" Scenario: Use site.time variable Given I have an "index.html" page that contains "{{ site.time }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see today's time in "_site/index.html" Scenario: Use site.posts variable for latest post @@ -43,7 +47,8 @@ Feature: Site data | Second Post | 2009-03-26 | My Second Post | | Third Post | 2009-03-27 | My Third Post | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Third Post: /2009/03/27/third-post.html" in "_site/index.html" Scenario: Use site.posts variable in a loop @@ -55,7 +60,8 @@ Feature: Site data | Second Post | 2009-03-26 | My Second Post | | Third Post | 2009-03-27 | My Third Post | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Third Post Second Post First Post" in "_site/index.html" Scenario: Use site.categories.code variable @@ -66,7 +72,8 @@ Feature: Site data | Awesome Hack | 2009-03-26 | code | puts 'Hello World' | | Delicious Beer | 2009-03-26 | food | 1) Yuengling | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Awesome Hack" in "_site/index.html" Scenario: Use site.tags variable @@ -76,7 +83,8 @@ Feature: Site data | title | date | tag | content | | Delicious Beer | 2009-03-26 | beer | 1) Yuengling | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "Yuengling" in "_site/index.html" Scenario: Order Posts by name when on the same date @@ -90,18 +98,21 @@ Feature: Site data | C | 2009-03-26 | C | | last | 2009-04-26 | last | When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "last:C, C:B,last B:A,C A:first,B first:,A" in "_site/index.html" Scenario: Use configuration date in site payload Given I have an "index.html" page that contains "{{ site.url }}" And I have a configuration file with "url" set to "http://example.com" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "http://example.com" in "_site/index.html" Scenario: Access Jekyll version via jekyll.version Given I have an "index.html" page that contains "{{ jekyll.version }}" When I run jekyll build - Then the _site directory should exist + Then I should get a zero exit status + And the _site directory should exist And I should see "\d+\.\d+\.\d+" in "_site/index.html" diff --git a/features/step_definitions.rb b/features/step_definitions.rb index 64213ea4..a6790a15 100644 --- a/features/step_definitions.rb +++ b/features/step_definitions.rb @@ -93,16 +93,20 @@ end # Given %r{^I have a configuration file with "(.*)" set to "(.*)"$} do |key, value| - File.write("_config.yml", "#{key}: #{value}\n") + config = if source_dir.join("_config.yml").exist? + SafeYAML.load_file(source_dir.join("_config.yml")) + else + {} + end + config[key] = YAML.load(value) + File.write("_config.yml", YAML.dump(config)) end # Given %r{^I have a configuration file with:$} do |table| - File.open("_config.yml", "w") do |f| - table.hashes.each do |row| - f.write("#{row["key"]}: #{row["value"]}\n") - end + table.hashes.each do |row| + step %(I have a configuration file with "#{row["key"]}" set to "#{row["value"]}") end end @@ -228,12 +232,17 @@ end # Then %r{^I should see "(.*)" in the build output$} do |text| - regexp = Regexp.new(text) - expect(jekyll_run_output).to match regexp + expect(jekyll_run_output).to match Regexp.new(text) +end + +# + +Then %r{^I should get a zero exit(?:\-| )status$} do + step %(I should see "EXIT STATUS: 0" in the build output) end # Then %r{^I should get a non-zero exit(?:\-| )status$} do - expect(jekyll_run_status.to_i).to be > 0 + expect(jekyll_run_status.to_i).not_to match(%r{EXIT STATUS: 0}) end diff --git a/features/support/helpers.rb b/features/support/helpers.rb index 62892612..d65695ce 100644 --- a/features/support/helpers.rb +++ b/features/support/helpers.rb @@ -2,6 +2,7 @@ require "fileutils" require "jekyll/utils" require "open3" require "time" +require "safe_yaml/load" class Paths SOURCE_DIR = Pathname.new(File.expand_path("../..", __dir__)) @@ -100,8 +101,13 @@ def run_in_shell(*args) end File.write(Paths.status_file, p.value.exitstatus) - File.write(Paths.output_file, out) if p.value.exitstatus == 0 - File.write(Paths.output_file, err) if p.value.exitstatus != 0 + File.open(Paths.output_file, "wb") do |f| + f.puts args.join(" ") + f.puts out + f.puts err + f.puts "EXIT STATUS: #{p.value.exitstatus}" + end + p.value end diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index a8e1d0a4..383bb024 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -97,13 +97,7 @@ module Jekyll # Returns the String extension for the output file. # e.g. ".html" for an HTML output file. def output_ext - if converters.all? { |c| c.is_a?(Jekyll::Converters::Identity) } - ext - else - converters.map do |c| - c.output_ext(ext) unless c.is_a?(Jekyll::Converters::Identity) - end.compact.last - end + Jekyll::Renderer.new(site, self).output_ext end # Determine which converter to use based on this convertible's diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index 911cb4e6..2911c4aa 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -59,7 +59,10 @@ module Jekyll end Utils.deep_merge_hashes!(data, other) if data.key?('date') && !data['date'].is_a?(Time) - data['date'] = Utils.parse_date(data['date'].to_s, "Document '#{relative_path}' does not have a valid date in the YAML front matter.") + data['date'] = Utils.parse_date( + data['date'].to_s, + "Document '#{relative_path}' does not have a valid date in the YAML front matter." + ) end data end diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index a3519f57..3760410b 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -7,6 +7,8 @@ module Jekyll attr_accessor :name, :ext, :basename attr_accessor :data, :content, :output + alias_method :extname, :ext + # Attributes for Liquid templates ATTRIBUTES_FOR_LIQUID = %w( content @@ -160,5 +162,13 @@ module Jekyll def index? basename == 'index' end + + def trigger_hooks(hook_name, *args) + Jekyll::Hooks.trigger :pages, hook_name, self, *args + end + + def write? + true.freeze + end end end diff --git a/lib/jekyll/renderer.rb b/lib/jekyll/renderer.rb index e6a41aea..c7b6042b 100644 --- a/lib/jekyll/renderer.rb +++ b/lib/jekyll/renderer.rb @@ -22,11 +22,7 @@ module Jekyll # # Returns the output extname including the leading period. def output_ext - @output_ext ||= if document.permalink - File.extname(document.permalink) - else - converters.first.output_ext(document.extname) - end + @output_ext ||= (permalink_ext || converter_output_ext) end ###################### @@ -38,10 +34,18 @@ module Jekyll payload["page"] = document.to_liquid - if document.collection.label == 'posts' && document.is_a?(Document) + if document.respond_to? :pager + payload["paginator"] = document.pager.to_liquid + end + + if document.is_a?(Document) && document.collection.label == 'posts' payload['site']['related_posts'] = document.related_posts end + # render and transform content (this becomes the final content of the object) + payload['highlighter_prefix'] = converters.first.highlighter_prefix + payload['highlighter_suffix'] = converters.first.highlighter_suffix + Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path document.trigger_hooks(:pre_render, payload) @@ -50,10 +54,6 @@ module Jekyll :registers => { :site => site, :page => payload['page'] } } - # render and transform content (this becomes the final content of the object) - payload['highlighter_prefix'] = converters.first.highlighter_prefix - payload['highlighter_suffix'] = converters.first.highlighter_suffix - output = document.content if document.render_with_liquid? @@ -164,5 +164,28 @@ module Jekyll output end + + private + + def permalink_ext + if document.permalink + permalink_ext = File.extname(document.permalink) + permalink_ext unless permalink_ext.empty? + end + end + + def converter_output_ext + if output_exts.size == 1 + output_exts.last + else + output_exts[-2] + end + end + + def output_exts + @output_exts ||= converters.map do |c| + c.output_ext(document.extname) + end.compact + end end end diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 465e154e..15698b99 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -176,7 +176,8 @@ module Jekyll pages.flatten.each do |page| if regenerator.regenerate?(page) - page.render(layouts, payload) + page.output = Jekyll::Renderer.new(self, page, payload).run + page.trigger_hooks(:post_render) end end diff --git a/test/helper.rb b/test/helper.rb index 936638d2..78b1f78b 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -42,6 +42,22 @@ Minitest::Reporters.use! [ ) ] +module Minitest::Assertions + def assert_exist(filename, msg = nil) + msg = message(msg) { + "Expected '#{filename}' to exist" + } + assert File.exist?(filename), msg + end + + def refute_exist(filename, msg = nil) + msg = message(msg) { + "Expected '#{filename}' not to exist" + } + refute File.exist?(filename), msg + end +end + class JekyllUnitTest < Minitest::Test include ::RSpec::Mocks::ExampleMethods diff --git a/test/source/+/foo.md b/test/source/+/foo.md index 30f9535f..bd2d1482 100644 --- a/test/source/+/foo.md +++ b/test/source/+/foo.md @@ -1,7 +1,7 @@ --- layout: default title : Page inside + -permalink: /+/plus+in+url +permalink: /+/plus+in+url.html --- Line 1 {{ page.title }} diff --git a/test/source/deal.with.dots.html b/test/source/deal.with.dots.html index 6c87d806..fb3d4734 100644 --- a/test/source/deal.with.dots.html +++ b/test/source/deal.with.dots.html @@ -1,6 +1,5 @@ --- title: Deal with dots -permalink: /deal.with.dots --- Let's test if jekyll deals properly with dots. diff --git a/test/test_cleaner.rb b/test/test_cleaner.rb index 819dbf5c..43d99503 100644 --- a/test/test_cleaner.rb +++ b/test/test_cleaner.rb @@ -21,19 +21,19 @@ class TestCleaner < JekyllUnitTest end should "keep the parent directory" do - assert File.exist?(dest_dir('to_keep')) + assert_exist dest_dir('to_keep') end should "keep the child directory" do - assert File.exist?(dest_dir('to_keep/child_dir')) + assert_exist dest_dir('to_keep', 'child_dir') end should "keep the file in the directory in keep_files" do - assert File.exist?(File.join(dest_dir('to_keep/child_dir'), 'index.html')) + assert_exist dest_dir('to_keep', 'child_dir', 'index.html') end should "delete the file in the directory not in keep_files" do - assert !File.exist?(File.join(dest_dir('to_keep'), 'index.html')) + refute_exist dest_dir('to_keep', 'index.html') end end @@ -41,8 +41,8 @@ class TestCleaner < JekyllUnitTest setup do clear_dest - FileUtils.mkdir_p(source_dir('no_files_inside/child_dir')) - FileUtils.touch(File.join(source_dir('no_files_inside/child_dir'), 'index.html')) + FileUtils.mkdir_p(source_dir('no_files_inside', 'child_dir')) + FileUtils.touch(source_dir('no_files_inside', 'child_dir', 'index.html')) @site = fixture_site @site.process @@ -57,15 +57,15 @@ class TestCleaner < JekyllUnitTest end should "keep the parent directory" do - assert File.exist?(dest_dir('no_files_inside')) + assert_exist dest_dir('no_files_inside') end should "keep the child directory" do - assert File.exist?(dest_dir('no_files_inside/child_dir')) + assert_exist dest_dir('no_files_inside', 'child_dir') end should "keep the file" do - assert File.exist?(File.join(dest_dir('no_files_inside/child_dir'), 'index.html')) + assert_exist source_dir('no_files_inside', 'child_dir', 'index.html') end end end diff --git a/test/test_coffeescript.rb b/test/test_coffeescript.rb index 68e19a52..09c9b0a8 100644 --- a/test/test_coffeescript.rb +++ b/test/test_coffeescript.rb @@ -37,7 +37,7 @@ JS end should "write a JS file in place" do - assert File.exist?(@test_coffeescript_file), "Can't find the converted CoffeeScript file in the dest_dir." + assert_exist @test_coffeescript_file, "Can't find the converted CoffeeScript file in the dest_dir." end should "produce JS" do diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index 39a8b3d9..301cd8f8 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -31,17 +31,22 @@ class TestGeneratedSite < JekyllUnitTest end should "hide unpublished page" do - assert !File.exist?(dest_dir('/unpublished.html')) + refute_exist dest_dir('/unpublished.html') end should "not copy _posts directory" do - assert !File.exist?(dest_dir('_posts')) + refute_exist dest_dir('_posts') + end + + should "process a page with a folder permalink properly" do + about = @site.pages.find {|page| page.name == 'about.html' } + assert_equal dest_dir('about', 'index.html'), about.destination(dest_dir) + assert_exist dest_dir('about', 'index.html') end should "process other static files and generate correct permalinks" do - assert File.exist?(dest_dir('/about/index.html')), "about/index.html should exist" - assert File.exist?(dest_dir('/contacts.html')), "contacts.html should exist" - assert File.exist?(dest_dir('/dynamic_file.php')), "dynamic_file.php should exist" + assert_exist dest_dir('contacts.html') + assert_exist dest_dir('dynamic_file.php') end should "print a nice list of static files" do @@ -72,15 +77,22 @@ OUTPUT should "ensure limit posts is 0 or more" do assert_raises ArgumentError do clear_dest - config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => -1}) - + config = Jekyll::Configuration::DEFAULTS.merge({ + 'source' => source_dir, + 'destination' => dest_dir, + 'limit_posts' => -1 + }) @site = fixture_site(config) end end should "acceptable limit post is 0" do clear_dest - config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 0}) + config = Jekyll::Configuration::DEFAULTS.merge({ + 'source' => source_dir, + 'destination' => dest_dir, + 'limit_posts' => 0 + }) assert Site.new(config), "Couldn't create a site with the given limit_posts." end diff --git a/test/test_new_command.rb b/test/test_new_command.rb index 33bd1044..f0d2a389 100644 --- a/test/test_new_command.rb +++ b/test/test_new_command.rb @@ -24,9 +24,9 @@ class TestNewCommand < JekyllUnitTest end should 'create a new directory' do - assert !File.exist?(@full_path) + refute_exist @full_path Jekyll::Commands::New.process(@args) - assert File.exist?(@full_path) + assert_exist @full_path end should 'display a success message' do @@ -96,9 +96,9 @@ class TestNewCommand < JekyllUnitTest end should 'create a new directory' do - assert !File.exist?(@site_name_with_spaces) + refute_exist @site_name_with_spaces capture_stdout { Jekyll::Commands::New.process(@multiple_args) } - assert File.exist?(@site_name_with_spaces) + assert_exist @site_name_with_spaces end end diff --git a/test/test_page.rb b/test/test_page.rb index 904f5bd5..2728b4e3 100644 --- a/test/test_page.rb +++ b/test/test_page.rb @@ -69,7 +69,6 @@ class TestPage < JekyllUnitTest @dest_file = dest_dir("deal.with.dots.html") assert_equal "deal.with.dots", @page.basename - assert_equal "/deal.with.dots", @page.url assert_equal @dest_file, @page.destination(dest_dir) end @@ -214,7 +213,7 @@ class TestPage < JekyllUnitTest do_render(page) page.write(dest_dir) - assert !File.exist?(unexpected) + refute_exist unexpected end end @@ -239,7 +238,7 @@ class TestPage < JekyllUnitTest page.write(dest_dir) assert File.directory?(dest_dir) - assert File.exist?(File.join(dest_dir, 'contacts.html')) + assert_exist dest_dir('contacts.html') end should "write even when the folder name is plus and permalink has +" do @@ -247,8 +246,8 @@ class TestPage < JekyllUnitTest do_render(page) page.write(dest_dir) - assert File.directory?(dest_dir) - assert File.exist?(File.join(dest_dir, '+', 'plus+in+url.html')) + assert File.directory?(dest_dir), "#{dest_dir} should be a directory" + assert_exist dest_dir('+', 'plus+in+url.html') end should "write even when permalink has '%# +'" do @@ -257,7 +256,7 @@ class TestPage < JekyllUnitTest page.write(dest_dir) assert File.directory?(dest_dir) - assert File.exist?(File.join(dest_dir, '+', '%# +.html')) + assert_exist dest_dir('+', '%# +.html') end should "write properly without html extension" do @@ -267,7 +266,7 @@ class TestPage < JekyllUnitTest page.write(dest_dir) assert File.directory?(dest_dir) - assert File.exist?(File.join(dest_dir, 'contacts', 'index.html')) + assert_exist dest_dir('contacts', 'index.html') end should "support .htm extension and respects that" do @@ -277,7 +276,7 @@ class TestPage < JekyllUnitTest page.write(dest_dir) assert File.directory?(dest_dir) - assert File.exist?(File.join(dest_dir, 'contacts', 'index.htm')) + assert_exist dest_dir('contacts', 'index.htm') end should "support .xhtml extension and respects that" do @@ -287,7 +286,7 @@ class TestPage < JekyllUnitTest page.write(dest_dir) assert File.directory?(dest_dir) - assert File.exist?(File.join(dest_dir, 'contacts', 'index.xhtml')) + assert_exist dest_dir('contacts', 'index.xhtml') end should "write properly with extension different from html" do @@ -296,10 +295,10 @@ class TestPage < JekyllUnitTest do_render(page) page.write(dest_dir) - assert_equal("/sitemap.xml", page.url) - assert_nil(page.url[/\.html$/]) + assert_equal "/sitemap.xml", page.url + assert_nil page.url[/\.html$/] assert File.directory?(dest_dir) - assert File.exist?(File.join(dest_dir,'sitemap.xml')) + assert_exist dest_dir('sitemap.xml') end should "write dotfiles properly" do @@ -308,7 +307,7 @@ class TestPage < JekyllUnitTest page.write(dest_dir) assert File.directory?(dest_dir) - assert File.exist?(File.join(dest_dir, '.htaccess')) + assert_exist dest_dir('.htaccess') end context "in a directory hierarchy" do @@ -318,7 +317,7 @@ class TestPage < JekyllUnitTest page.write(dest_dir) assert File.directory?(dest_dir) - assert File.exist?(File.join(dest_dir, 'contacts', 'index.html')) + assert_exist dest_dir('contacts', 'index.html') end should "write properly" do @@ -327,7 +326,7 @@ class TestPage < JekyllUnitTest page.write(dest_dir) assert File.directory?(dest_dir) - assert File.exist?(File.join(dest_dir, 'contacts', 'bar.html')) + assert_exist dest_dir('contacts', 'bar.html') end should "write properly without html extension" do @@ -337,7 +336,7 @@ class TestPage < JekyllUnitTest page.write(dest_dir) assert File.directory?(dest_dir) - assert File.exist?(File.join(dest_dir, 'contacts', 'bar', 'index.html')) + assert_exist dest_dir('contacts', 'bar', 'index.html') end end end diff --git a/test/test_regenerator.rb b/test/test_regenerator.rb index c9dfb573..1ed21211 100644 --- a/test/test_regenerator.rb +++ b/test/test_regenerator.rb @@ -112,7 +112,7 @@ class TestRegenerator < JekyllUnitTest assert_equal 1, @regenerator.metadata.size path = @regenerator.metadata.keys[0] - assert File.exist?(@layout_path) + assert_exist @layout_path @regenerator.add_dependency(path, @layout_path) File.rename(@layout_path, @layout_path + ".tmp") diff --git a/test/test_site.rb b/test/test_site.rb index 970084cf..e0883b49 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -275,25 +275,25 @@ class TestSite < JekyllUnitTest should 'remove orphaned files in destination' do @site.process - assert !File.exist?(dest_dir('obsolete.html')) - assert !File.exist?(dest_dir('qux')) - assert !File.exist?(dest_dir('quux')) - assert File.exist?(dest_dir('.git')) - assert File.exist?(dest_dir('.git/HEAD')) + refute_exist dest_dir('obsolete.html') + refute_exist dest_dir('qux') + refute_exist dest_dir('quux') + assert_exist dest_dir('.git') + assert_exist dest_dir('.git', 'HEAD') end should 'remove orphaned files in destination - keep_files .svn' do config = site_configuration('keep_files' => %w{.svn}) @site = Site.new(config) @site.process - assert !File.exist?(dest_dir('.htpasswd')) - assert !File.exist?(dest_dir('obsolete.html')) - assert !File.exist?(dest_dir('qux')) - assert !File.exist?(dest_dir('quux')) - assert !File.exist?(dest_dir('.git')) - assert !File.exist?(dest_dir('.git/HEAD')) - assert File.exist?(dest_dir('.svn')) - assert File.exist?(dest_dir('.svn/HEAD')) + refute_exist dest_dir('.htpasswd') + refute_exist dest_dir('obsolete.html') + refute_exist dest_dir('qux') + refute_exist dest_dir('quux') + refute_exist dest_dir('.git') + refute_exist dest_dir('.git', 'HEAD') + assert_exist dest_dir('.svn') + assert_exist dest_dir('.svn', 'HEAD') end end