Additional fixup for engine specs
This commit is contained in:
parent
91720d392a
commit
eaf03be8d5
@ -1,6 +1,7 @@
|
||||
Feature: Engine
|
||||
As a website user
|
||||
I want to be able to view someones created locomotive pages
|
||||
As a designer
|
||||
I want to be able to build simple page html layouts
|
||||
that render correctly to the client
|
||||
|
||||
Background:
|
||||
Given I have the site: "test site" set up
|
||||
@ -16,102 +17,6 @@ Scenario: Simple Page
|
||||
Hello World
|
||||
"""
|
||||
|
||||
Scenario: Page extending a layout with multiple blocks
|
||||
Given a layout named "layout_with_sidebar" with the source:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
<div class="content">
|
||||
<div class="sidebar">
|
||||
{% block sidebar %}DEFAULT SIDEBAR CONTENT{% endblock %}
|
||||
</div>
|
||||
<div class="body">
|
||||
{% block body %}DEFAULT BODY CONTENT{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer"></div>
|
||||
"""
|
||||
And a page named "hello-world-multiblocks" with the template:
|
||||
"""
|
||||
{% extends 'layout_with_sidebar' %}
|
||||
{% block body %}Hello world{% endblock %}
|
||||
"""
|
||||
When I view the rendered page at "/hello-world-multiblocks"
|
||||
Then the rendered output should look like:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
<div class="content">
|
||||
<div class="sidebar">
|
||||
DEFAULT SIDEBAR CONTENT
|
||||
</div>
|
||||
<div class="body">
|
||||
Hello world
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer"></div>
|
||||
"""
|
||||
|
||||
Scenario: Page extending a layout with multiple blocks which extends another template
|
||||
Given a layout named "layout_with_sidebar" with the source:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
<div class="content">
|
||||
<div class="sidebar">{% block sidebar %}DEFAULT SIDEBAR CONTENT{% endblock %}</div>
|
||||
<div class="body">
|
||||
{% block body %}DEFAULT BODY CONTENT{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer"></div>
|
||||
"""
|
||||
And a layout named "custom_layout_with_sidebar" with the source:
|
||||
"""
|
||||
{% extends 'layout_with_sidebar' %}
|
||||
{% block sidebar %}Custom sidebar{% endblock %}
|
||||
{% block body %}Hello{% endblock %}
|
||||
"""
|
||||
And a page named "hello-world-multiblocks" with the template:
|
||||
"""
|
||||
{% extends 'custom_layout_with_sidebar' %}
|
||||
{% block body %}{{ block.super }} world{% endblock %}
|
||||
"""
|
||||
When I view the rendered page at "/hello-world-multiblocks"
|
||||
Then the rendered output should look like:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
<div class="content">
|
||||
<div class="sidebar">Custom sidebar</div>
|
||||
<div class="body">
|
||||
Hello world
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer"></div>
|
||||
"""
|
||||
|
||||
Scenario: Simple Page with layout
|
||||
Given a layout named "above_and_below" with the source:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
<div class="body">
|
||||
{% block body %}{% endblock %}
|
||||
</div>
|
||||
<div class="footer"></div>
|
||||
"""
|
||||
|
||||
And a page named "hello-world-with-layout" with the template:
|
||||
"""
|
||||
{% extends 'above_and_below' %}
|
||||
{% block body %}Hello World{% endblock %}
|
||||
"""
|
||||
|
||||
When I view the rendered page at "/hello-world-with-layout"
|
||||
Then the rendered output should look like:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
<div class="body">
|
||||
Hello World
|
||||
</div>
|
||||
<div class="footer"></div>
|
||||
"""
|
||||
|
||||
# Scenario: Page with Parts
|
||||
# Given a layout named "layout_with_sidebar" with the source:
|
||||
# """
|
||||
|
@ -1,4 +1,110 @@
|
||||
Scenario: Simple Page extending a layout with multiple embedded blocks which extends another template
|
||||
Feature: Engine
|
||||
As a designer
|
||||
I want to be able to build more complex page html layouts
|
||||
with shared template code
|
||||
that render correctly to the client
|
||||
|
||||
Background:
|
||||
Given I have the site: "test site" set up
|
||||
|
||||
Scenario: Liquid Inheritance with a single block
|
||||
Given a layout named "above_and_below" with the source:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
<div class="body">
|
||||
{% block body %}{% endblock %}
|
||||
</div>
|
||||
<div class="footer"></div>
|
||||
"""
|
||||
|
||||
And a page named "hello-world-with-layout" with the template:
|
||||
"""
|
||||
{% extends 'above_and_below' %}
|
||||
{% block body %}Hello World{% endblock %}
|
||||
"""
|
||||
|
||||
When I view the rendered page at "/hello-world-with-layout"
|
||||
Then the rendered output should look like:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
<div class="body">
|
||||
Hello World
|
||||
</div>
|
||||
<div class="footer"></div>
|
||||
"""
|
||||
|
||||
Scenario: Liquid Inheritance with multiple blocks
|
||||
Given a layout named "layout_with_sidebar" with the source:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
<div class="content">
|
||||
<div class="sidebar">
|
||||
{% block sidebar %}DEFAULT SIDEBAR CONTENT{% endblock %}
|
||||
</div>
|
||||
<div class="body">
|
||||
{% block body %}DEFAULT BODY CONTENT{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer"></div>
|
||||
"""
|
||||
And a page named "hello-world-multiblocks" with the template:
|
||||
"""
|
||||
{% extends 'layout_with_sidebar' %}
|
||||
{% block body %}Hello world{% endblock %}
|
||||
"""
|
||||
When I view the rendered page at "/hello-world-multiblocks"
|
||||
Then the rendered output should look like:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
<div class="content">
|
||||
<div class="sidebar">
|
||||
DEFAULT SIDEBAR CONTENT
|
||||
</div>
|
||||
<div class="body">
|
||||
Hello world
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer"></div>
|
||||
"""
|
||||
|
||||
Scenario: Multiple inheritance (layout extending another layout)
|
||||
Given a layout named "layout_with_sidebar" with the source:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
<div class="content">
|
||||
<div class="sidebar">{% block sidebar %}DEFAULT SIDEBAR CONTENT{% endblock %}</div>
|
||||
<div class="body">
|
||||
{% block body %}DEFAULT BODY CONTENT{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer"></div>
|
||||
"""
|
||||
And a layout named "custom_layout_with_sidebar" with the source:
|
||||
"""
|
||||
{% extends 'layout_with_sidebar' %}
|
||||
{% block sidebar %}Custom sidebar{% endblock %}
|
||||
{% block body %}Hello{% endblock %}
|
||||
"""
|
||||
And a page named "hello-world-multiblocks" with the template:
|
||||
"""
|
||||
{% extends 'custom_layout_with_sidebar' %}
|
||||
{% block body %}{{ block.super }} world{% endblock %}
|
||||
"""
|
||||
When I view the rendered page at "/hello-world-multiblocks"
|
||||
Then the rendered output should look like:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
<div class="content">
|
||||
<div class="sidebar">Custom sidebar</div>
|
||||
<div class="body">
|
||||
Hello world
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer"></div>
|
||||
"""
|
||||
|
||||
|
||||
Scenario: Page extending a layout with multiple embedded blocks which extends another template
|
||||
Given a layout named "layout_with_sidebar" with the source:
|
||||
"""
|
||||
<div class="header"></div>
|
||||
|
@ -1,9 +1,9 @@
|
||||
### Pages
|
||||
|
||||
# helps create a simple content page (parent: "index") with a slug, contents, and layout
|
||||
def create_content_page(page_slug, page_contents, layout = nil, template = nil)
|
||||
def create_content_page(page_slug, page_contents, template = nil)
|
||||
@home = @site.pages.where(:slug => "index").first || Factory(:page)
|
||||
page = @site.pages.create(:slug => page_slug, :body => page_contents, :layout => layout, :parent => @home, :title => "some title", :published => true, :layout_template => template)
|
||||
page = @site.pages.create(:slug => page_slug, :body => page_contents, :parent => @home, :title => "some title", :published => true, :layout_template => template)
|
||||
page.should be_valid
|
||||
page
|
||||
end
|
||||
@ -13,16 +13,8 @@ Given /^a simple page named "([^"]*)" with the body:$/ do |page_slug, page_conte
|
||||
@page = create_content_page(page_slug, page_contents)
|
||||
end
|
||||
|
||||
# creates a page (that has a layout)
|
||||
Given /^a page named "([^"]*)" with the layout "([^"]*)" and the body:$/ do |page_slug, layout_name, page_contents|
|
||||
layout = @site.layouts.where(:name => layout_name).first
|
||||
raise "Could not find layout: #{layout_name}" unless layout
|
||||
|
||||
@page = create_content_page(page_slug, page_contents, layout)
|
||||
end
|
||||
|
||||
Given /^a page named "([^"]*)" with the template:$/ do |page_slug, template|
|
||||
@page = create_content_page(page_slug, '', nil, template)
|
||||
@page = create_content_page(page_slug, '', template)
|
||||
end
|
||||
|
||||
# creates a layout
|
||||
|
Loading…
Reference in New Issue
Block a user