Feature: Rendering dynamic templates As a designer I want to render a content item within a template So that the end user can update their site Background: Given this template exists at "dynamic.nou.html" """ title: required: true body: required: true ---

{{ title }}

{{ body }}

""" Scenario: All fields provided Given this content item exists at "/dynamic" | template | dynamic | | title | An example | | body | Some content within the template. | When I view "/dynamic" Then the page should load And the headline should be "An example" And the body text should be "Some content within the template." Scenario: Some fields are missing Given this content item exists at "/dynamic" | template | dynamic | | title | An example | When I view "/dynamic" Then the page should return a 500 error And the headline should be "Missing Fields" And the body text should be "The following fields were missing from your content: body" Scenario: Rendering within the default layout Given this layout exists at "default.nou.html" """ {{ title }}

A Site

{{ content }}
""" And this content item exists at "/layout" | template | dynamic | | title | Hello, world! | | body | Good morning world. | When I view "/layout" Then the page should load And the page title should be "Hello, world!" And the page header should be "A Site" And the body text should be "Good morning world." Scenario: Rendering with a non-default layout Given this layout exists at "non_default_layout.nou.html" """ {{ title }}

A Site

{{ content }}
""" And this content item exists at "/layout" | template | dynamic | | layout | non_default_layout | | title | Hello, world! | | body | Good morning world. | When I view "/layout" Then the page should load And the page title should be "Hello, world!" And the page header should be "A Site" And the body text should be "Good morning world." Scenario: Rendering with a missing non-default layout Given no layout exists at "non_default_layout.nou.html" And this content item exists at "/layout" | template | dynamic | | layout | non_default_layout | | title | Hello, world! | | body | Good morning world. | When I view "/layout" Then the page should return a 500 error And the body text should be "The layout 'non_default_layout' does not exist within the current theme."