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

@ -2,13 +2,21 @@ Feature: Custom layouts
In order easily switch between relative and absolute paths In order easily switch between relative and absolute paths
Scenario: Using custom :layout attribute 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" And the Server is running at "custom-layout-app2"
When I go to "/custom-layout.html" When I go to "/custom-layout.html"
Then I should see "Custom Layout" Then I should see "Custom Layout"
Scenario: Using custom :layout attribute with folders 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" And the Server is running at "custom-layout-app2"
When I go to "/custom-layout-dir" When I go to "/custom-layout-dir"
Then I should see "Custom Layout" Then I should see "Custom Layout"
@ -18,7 +26,11 @@ Feature: Custom layouts
Then I should see "Custom Layout" Then I should see "Custom Layout"
Scenario: Using custom :layout attribute with folders 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" And the Server is running at "custom-layout-app2"
When I go to "/custom-layout-dir" When I go to "/custom-layout-dir"
Then I should see "Custom Layout" Then I should see "Custom Layout"
@ -28,7 +40,11 @@ Feature: Custom layouts
Then I should see "Custom Layout" Then I should see "Custom Layout"
Scenario: Using custom :layout attribute with folders 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" And the Server is running at "custom-layout-app2"
When I go to "/custom-layout-dir" When I go to "/custom-layout-dir"
Then I should see "Custom Layout" Then I should see "Custom Layout"

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 # Search the root of the project for required files
$LOAD_PATH.unshift(root) unless $LOAD_PATH.include?(root) $LOAD_PATH.unshift(root) unless $LOAD_PATH.include?(root)
# Evaluate a passed block if given
config_context.instance_exec(&block) if block_given?
super super
::Middleman::Extension.clear_after_extension_callbacks ::Middleman::Extension.clear_after_extension_callbacks