Feature: Helpers
Scenario: `path_list` helper
Given a fixture app "path-list-app"
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain '
No Path List
'
And the helper result "build/page/list/index.html" should contain:
"""
page:/page/
list:/page/list/
"""
Scenario: `breadcrumbs` helper
Given a fixture app "breadcrumbs-app"
When I run `middleman build --verbose`
Then the exit status should be 0
# /index.html
And the helper result "build/index.html" should contain ''
And the helper result "build/index.html" should contain '- Top
'
# /dir/page.html
And the helper result "build/dir/page.html" should contain:
"""
- Top
- dir
- page
"""
Scenario: `breadcrumbs` helper with params
Given a fixture app "breadcrumbs-params-app"
When I run `middleman build --verbose`
Then the exit status should be 0
# /index.html
And the helper result "build/index.html" should contain ''
And the helper result "build/index.html" should contain '- Home
'
Scenario: `children_pages` helper
Given a fixture app "children-pages-app"
And a file named "source/templates/index.html.erb" with:
"""
<% children_pages.each do |page| %>
- <%= link_to(page_name(page), page_url(page)) %>
<% end %>
"""
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain:
"""
- dir1
- dir2
- Page1 Title
"""
And the helper result "build/dir1/index.html" should contain:
"""
- dir1/sub_dir1
- dir1/sub_dir2
- dir1/Page1 Title
- dir1/Page2 Title
- dir1/Page3 Title
- dir1/no-title-page
"""
Scenario: `children_pages` helper with "order_by = :desc" option
Given a fixture app "children-pages-app"
And a file named "source/templates/index.html.erb" with:
"""
<% children_pages(:date, :desc).each do |page| %>
- <%= link_to(page_name(page), page_url(page)) %>
<% end %>
"""
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/index.html" should contain:
"""
- dir2
- dir1
- Page1 Title
"""
And the helper result "build/dir1/index.html" should contain:
"""
- dir1/sub_dir2
- dir1/sub_dir1
- dir1/no-title-page
- dir1/Page3 Title
- dir1/Page2 Title
- dir1/Page1 Title
"""
Scenario: `children_pages` helper with "key = :category" option
Given a fixture app "children-pages-with-category-app"
And a file named "source/templates/index.html.erb" with:
"""
<% children_pages(:category).each do |page| %>
- <%= link_to(page_name(page), page_url(page)) %>
<% end %>
"""
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/dir1/index.html" should contain:
"""
- dir1/sub_dir1
- dir1/sub_dir2
- dir1/Page1 Title
- dir1/Page2 Title
- dir1/Page3 Title
- dir1/no-title-page
"""
Scenario: `children_pages` helper with "key = :category" and "order_by = :desc" option
Given a fixture app "children-pages-with-category-app"
And a file named "source/templates/index.html.erb" with:
"""
<% children_pages(:category, :desc).each do |page| %>
- <%= link_to(page_name(page), page_url(page)) %>
<% end %>
"""
When I run `middleman build --verbose`
Then the exit status should be 0
And the helper result "build/dir1/index.html" should contain:
"""
- dir1/sub_dir2
- dir1/sub_dir1
- dir1/no-title-page
- dir1/Page3 Title
- dir1/Page2 Title
- dir1/Page1 Title
"""