Rewrite sitemap_traversal tests to better reflect what should actually happen, and to expose a bug in current_page.

This commit is contained in:
Ben Hollis 2012-03-07 21:21:49 -08:00
parent 739a8633ae
commit efe1d45af7
2 changed files with 26 additions and 24 deletions

View file

@ -3,6 +3,7 @@ Feature: Step through sitemap as a tree
Scenario: Root Scenario: Root
Given the Server is running at "traversal-app" Given the Server is running at "traversal-app"
When I go to "/index.html" When I go to "/index.html"
Then I should see "Path: index.html"
Then I should not see "Parent: index.html" Then I should not see "Parent: index.html"
Then I should see "Child: sub/index.html" Then I should see "Child: sub/index.html"
Then I should see "Child: root.html" Then I should see "Child: root.html"
@ -11,6 +12,7 @@ Feature: Step through sitemap as a tree
Scenario: Directories have children and a parent Scenario: Directories have children and a parent
Given the Server is running at "traversal-app" Given the Server is running at "traversal-app"
When I go to "/sub/index.html" When I go to "/sub/index.html"
Then I should see "Path: sub/index.html"
Then I should see "Parent: index.html" Then I should see "Parent: index.html"
Then I should see "Child: sub/fake.html" Then I should see "Child: sub/fake.html"
Then I should see "Child: sub/fake2.html" Then I should see "Child: sub/fake2.html"
@ -18,41 +20,38 @@ Feature: Step through sitemap as a tree
Then I should see "Child: sub/sibling2.html" Then I should see "Child: sub/sibling2.html"
Then I should see "Child: sub/sub2/index.html" Then I should see "Child: sub/sub2/index.html"
Then I should see "Sibling: root.html" Then I should see "Sibling: root.html"
Scenario: Page has siblings Scenario: Directory accessed without index.html
Given the Server is running at "traversal-app" Given the Server is running at "traversal-app"
When I go to "/sub/sibling.html" When I go to "/sub/"
Then I should see "Path: sub/index.html"
Then I should see "Parent: index.html"
Then I should see "Child: sub/fake.html"
Then I should see "Child: sub/fake2.html"
Then I should see "Child: sub/sibling.html"
Then I should see "Child: sub/sibling2.html"
Then I should see "Child: sub/sub2/index.html"
Then I should see "Sibling: root.html"
Scenario: Page has siblings, parent, and source file
Given the Server is running at "traversal-app"
When I go to "/sub/sibling/"
Then I should see "Parent: sub/index.html"
Then I should see "Sibling: sub/fake.html" Then I should see "Sibling: sub/fake.html"
Then I should see "Sibling: sub/fake2.html" Then I should see "Sibling: sub/fake2.html"
Then I should see "Sibling: sub/sibling2.html" Then I should see "Sibling: sub/sibling2.html"
Then I should see "Sibling: sub/sub2/index.html" Then I should see "Sibling: sub/sub2/index.html"
Then I should see "Source: source/sub/sibling.html.erb"
Scenario: Proxied page has siblings Scenario: Proxied page has siblings, parent, and source file
Given the Server is running at "traversal-app" Given the Server is running at "traversal-app"
When I go to "/sub/fake.html" When I go to "/sub/fake/"
Then I should see "Path: sub/fake.html"
Then I should see "Parent: sub/index.html"
Then I should see "Sibling: sub/fake2.html" Then I should see "Sibling: sub/fake2.html"
Then I should see "Sibling: sub/sibling.html" Then I should see "Sibling: sub/sibling.html"
Then I should see "Sibling: sub/sibling2.html" Then I should see "Sibling: sub/sibling2.html"
Then I should see "Sibling: sub/sub2/index.html" Then I should see "Sibling: sub/sub2/index.html"
Scenario: Page has parent
Given the Server is running at "traversal-app"
When I go to "/sub/sibling.html"
Then I should see "Parent: sub/index.html"
Scenario: Proxied page has parent
Given the Server is running at "traversal-app"
When I go to "/sub/fake.html"
Then I should see "Parent: sub/index.html"
Scenario: Page has source_file
Given the Server is running at "traversal-app"
When I go to "/sub/sibling.html"
Then I should see "Source: source/sub/sibling.html.erb"
Scenario: Proxied page has source_file
Given the Server is running at "traversal-app"
When I go to "/sub/fake.html"
Then I should see "Source: source/proxied.html.erb" Then I should see "Source: source/proxied.html.erb"
Scenario: Child pages have data Scenario: Child pages have data
@ -64,6 +63,7 @@ Feature: Step through sitemap as a tree
Scenario: When directory_index extension is active, child pages are found in named directory Scenario: When directory_index extension is active, child pages are found in named directory
Given the Server is running at "traversal-app" Given the Server is running at "traversal-app"
When I go to "/directory-indexed" When I go to "/directory-indexed"
Then I should see "Path: directory-indexed.html"
Then I should see "Parent: index.html" Then I should see "Parent: index.html"
Then I should see "Child: directory-indexed/fake.html" Then I should see "Child: directory-indexed/fake.html"
Then I should see "Child: directory-indexed/fake2.html" Then I should see "Child: directory-indexed/fake2.html"

View file

@ -1,3 +1,5 @@
Path: <%= current_page.path %>
Source: <%= current_page.source_file.sub(root + "/", "") %> Source: <%= current_page.source_file.sub(root + "/", "") %>
<% if current_page.parent %> <% if current_page.parent %>