Add configuration fallback for paginate, and fix tests.

This commit is contained in:
Parker Moore 2015-01-31 12:22:32 -08:00
parent 65d43ef398
commit a87cda4b12
5 changed files with 31 additions and 3 deletions

View File

@ -17,7 +17,10 @@ Feature: Markdown
And I should see "<h1 id=\"my-title\">My Title</h1>" in "_site/index.html"
Scenario: Markdown in pagination on index
Given I have a configuration file with "paginate" set to "5"
Given I have a configuration file with:
| key | value |
| paginate | 5 |
| gems | [jekyll-paginate] |
And I have an "index.html" page that contains "Index - {% for post in paginator.posts %} {{ post.content }} {% endfor %}"
And I have a _posts directory
And I have the following post:

View File

@ -4,7 +4,10 @@ Feature: Site pagination
I want divide the posts in several pages
Scenario Outline: Paginate with N posts per page
Given I have a configuration file with "paginate" set to "<num>"
Given I have a configuration file with:
| key | value |
| paginate | <num> |
| gems | [jekyll-paginate] |
And I have a _layouts directory
And I have an "index.html" page that contains "{{ paginator.posts.size }}"
And I have a _posts directory
@ -32,6 +35,7 @@ Feature: Site pagination
| paginate | 1 |
| paginate_path | /blog/page-:num |
| permalink | /blog/:year/:month/:day/:title |
| gems | [jekyll-paginate] |
And I have a blog directory
And I have an "blog/index.html" page that contains "{{ paginator.posts.size }}"
And I have a _posts directory
@ -59,6 +63,7 @@ Feature: Site pagination
| paginate | 1 |
| paginate_path | /blog/page/:num |
| permalink | /blog/:year/:month/:day/:title |
| gems | [jekyll-paginate] |
And I have a blog directory
And I have an "blog/index.html" page that contains "{{ paginator.posts.size }}"
And I have an "index.html" page that contains "Don't pick me!"

View File

@ -15,6 +15,7 @@ Feature: Rendering
Scenario: Don't place asset files in layout
Given I have an "index.scss" page with layout "simple" that contains ".foo-bar { color:black; }"
And I have an "index.coffee" page with layout "simple" that contains "whatever()"
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
@ -28,8 +29,15 @@ Feature: Rendering
Then the _site directory should exist
And I should see ".foo-bar {\n color: red; }" in "_site/index.css"
Scenario: Render liquid in CoffeeScript
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
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
And I should see "hey = 'for cicada';" in "_site/index.js"

View File

@ -168,6 +168,12 @@ When /^I delete the file "(.*)"$/ do |file|
File.delete(file)
end
##################
#
# Checking stuff
#
##################
Then /^the (.*) directory should +exist$/ do |dir|
assert File.directory?(dir), "The directory \"#{dir}\" does not exist"
end

View File

@ -261,6 +261,12 @@ module Jekyll
"Markdown processor. Maruku support has been deprecated and will " +
"be removed in 3.0.0. We recommend you switch to Kramdown."
end
if config.key?('paginate') && config['paginate'] && !(config['gems'] || []).include?('jekyll-paginate')
Jekyll::Deprecator.deprecation_message "You appear to have pagination " +
"turned on, but you haven't included the `jekyll-paginate` gem. " +
"Ensure you have `gems: [jekyll-paginate]` in your configuration file."
end
config
end