Fix custom layouts tests

This commit is contained in:
Ben Hollis 2014-06-14 12:38:44 -07:00
parent 416428444c
commit f07bed4ecf
3 changed files with 25 additions and 18 deletions

View file

@ -1,14 +1,22 @@
Feature: Custom layouts
In order easily switch between relative and absolute paths
Scenario: Using custom :layout attribute
Given page "/custom-layout.html" has layout "custom"
Given a fixture app "custom-layout-app2"
And a file named "config.rb" with:
"""
page '/custom-layout.html', layout: :custom
"""
And the Server is running at "custom-layout-app2"
When I go to "/custom-layout.html"
Then I should see "Custom Layout"
Scenario: Using custom :layout attribute with folders
Given page "/custom-layout-dir/" has layout "custom"
Given a fixture app "custom-layout-app2"
And a file named "config.rb" with:
"""
page '/custom-layout-dir/', layout: :custom
"""
And the Server is running at "custom-layout-app2"
When I go to "/custom-layout-dir"
Then I should see "Custom Layout"
@ -16,9 +24,13 @@ Feature: Custom layouts
Then I should see "Custom Layout"
When I go to "/custom-layout-dir/index.html"
Then I should see "Custom Layout"
Scenario: Using custom :layout attribute with folders
Given page "/custom-layout-dir" has layout "custom"
Given a fixture app "custom-layout-app2"
And a file named "config.rb" with:
"""
page '/custom-layout-dir', layout: :custom
"""
And the Server is running at "custom-layout-app2"
When I go to "/custom-layout-dir"
Then I should see "Custom Layout"
@ -26,9 +38,13 @@ Feature: Custom layouts
Then I should see "Custom Layout"
When I go to "/custom-layout-dir/index.html"
Then I should see "Custom Layout"
Scenario: Using custom :layout attribute with folders
Given page "/custom-layout-dir/index.html" has layout "custom"
Given a fixture app "custom-layout-app2"
And a file named "config.rb" with:
"""
page '/custom-layout-dir/index.html', layout: :custom
"""
And the Server is running at "custom-layout-app2"
When I go to "/custom-layout-dir"
Then I should see "Custom Layout"
@ -36,7 +52,7 @@ Feature: Custom layouts
Then I should see "Custom Layout"
When I go to "/custom-layout-dir/index.html"
Then I should see "Custom Layout"
Scenario: Setting layout inside a matching page block
Given the Server is running at "page-helper-layout-block-app"
When I go to "/index.html"

View file

@ -1,6 +0,0 @@
Given /^page "([^\"]*)" has layout "([^\"]*)"$/ do |url, layout|
@initialize_commands ||= []
@initialize_commands << lambda {
page(url, layout: layout.to_sym)
}
end

View file

@ -83,9 +83,6 @@ module Middleman
# Search the root of the project for required files
$LOAD_PATH.unshift(root) unless $LOAD_PATH.include?(root)
# Evaluate a passed block if given
config_context.instance_exec(&block) if block_given?
super
::Middleman::Extension.clear_after_extension_callbacks