Skip to content

Commit

Permalink
features: validate the exit status of 0 for successful calls
Browse files Browse the repository at this point in the history
  • Loading branch information
parkr committed Jan 18, 2016
1 parent 9a6f4e0 commit 736a800
Show file tree
Hide file tree
Showing 16 changed files with 286 additions and 143 deletions.
33 changes: 22 additions & 11 deletions features/collections.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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: <p>Use <code class=\"highlighter-rouge\">Jekyll.configuration</code> to build a full configuration for use w/Jekyll.</p>\n\n<p>Whatever: foo.bar</p>\n<p>Signs are nice</p>\n<p><code class=\"highlighter-rouge\">Jekyll.sanitized_path</code> is used to make sure your path is in your source.</p>\n<p>Run your generators! default</p>\n<p>Page without title.</p>\n<p>Run your generators! default</p>" in "_site/index.html"
And the "_site/methods/configuration.html" file should not exist

Expand All @@ -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"
Expand All @@ -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 "<p>Whatever: foo.bar</p>" in "_site/methods/configuration/index.html"

Scenario: Rendered document in a layout
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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: <p>Use <code class=\"highlighter-rouge\">Jekyll.configuration</code> to build a full configuration for use w/Jekyll.</p>\n\n<p>Whatever: foo.bar</p>" in "_site/index.html"

Scenario: Filter documents by where
Expand All @@ -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
Expand All @@ -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: <p>Page without title.</p>" in "_site/index.html"

Scenario: Sort by relative_path
Expand All @@ -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"
48 changes: 32 additions & 16 deletions features/create_sites.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,15 +23,17 @@ 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
Given I have a _layouts directory
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
Expand All @@ -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: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"

Scenario: Basic site with layout inside a subfolder and a post
Expand All @@ -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: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"

Scenario: Basic site with layouts, pages, posts and files
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
12 changes: 8 additions & 4 deletions features/drafts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"
24 changes: 16 additions & 8 deletions features/embed_filters.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 &amp; Wars" in "_site/2009/03/27/star-wars.html"

Scenario: Calculate number of words
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 <p><em>Obi-wan</em></p>" in "_site/2009/03/27/star-wars.html"

Scenario: Sort by an arbitrary variable
Expand All @@ -68,7 +73,8 @@ 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"

Expand All @@ -85,7 +91,8 @@ Feature: Embed filters
| 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
Expand All @@ -101,5 +108,6 @@ Feature: Embed filters
| 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"
Loading

0 comments on commit 736a800

Please sign in to comment.