diff --git a/features/collections.feature b/features/collections.feature index de5e2a22..ba663510 100644 --- a/features/collections.feature +++ b/features/collections.feature @@ -94,6 +94,51 @@ Feature: Collections And I should see "Collections: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _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" unless Windows And I should see "Collections: _methods/3940394-21-9393050-fifif1323-test.md _methods/collection/entries _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/yaml_with_dots.md" in "_site/index.html" if on Windows + Scenario: Rendered collection with document with future date + Given I have a _puppies directory + And I have the following documents under the puppies collection: + | title | date | content | + | Rover | 2007-12-31 | content for Rover. | + | Fido | 2120-12-31 | content for Fido. | + And I have a "_config.yml" file with content: + """ + collections: + puppies: + output: true + """ + When I run jekyll build + Then I should get a zero exit status + And the _site directory should exist + And I should see "content for Rover" in "_site/puppies/rover.html" + And the "_site/puppies/fido.html" file should not exist + When I run jekyll build --future + Then I should get a zero exit status + And the _site directory should exist + And the "_site/puppies/fido.html" file should exist + + Scenario: Hidden collection with document with future date + Given I have a _puppies directory + And I have the following documents under the puppies collection: + | title | date | content | + | Rover | 2007-12-31 | content for Rover. | + | Fido | 2120-12-31 | content for Fido. | + And I have a "_config.yml" file with content: + """ + collections: + puppies: + output: false + """ + And I have a "foo.txt" file that contains "random static file" + When I run jekyll build + Then I should get a zero exit status + And the _site directory should exist + And the "_site/puppies/rover.html" file should not exist + And the "_site/puppies/fido.html" file should not exist + When I run jekyll build --future + Then I should get a zero exit status + And the _site directory should exist + And the "_site/puppies/fido.html" file should not exist + Scenario: All the documents Given I have an "index.html" page that contains "All documents: {% for doc in site.documents %}{{ doc.relative_path }} {% endfor %}" And I have fixture collections diff --git a/features/step_definitions.rb b/features/step_definitions.rb index bcbfcb9a..c22adb48 100644 --- a/features/step_definitions.rb +++ b/features/step_definitions.rb @@ -93,6 +93,19 @@ end # +Given(%r!^I have the following documents? under the (.*) collection:$!) do |folder, table| + table.hashes.each do |input_hash| + title = slug(input_hash["title"]) + filename = "#{title}.md" + dest_folder = "_#{folder}" + + path = File.join(dest_folder, filename) + File.write(path, file_content_from_hash(input_hash)) + end +end + +# + Given(%r!^I have a configuration file with "(.*)" set to "(.*)"$!) do |key, value| config = \ if source_dir.join("_config.yml").exist?