Cleaning up Page steps and adding layout feature scenario
This commit is contained in:
parent
2b14c9c992
commit
48c056c723
@ -6,7 +6,7 @@ Feature: Engine
|
|||||||
Given I have the site: "test site" set up
|
Given I have the site: "test site" set up
|
||||||
|
|
||||||
Scenario: Simple Page
|
Scenario: Simple Page
|
||||||
Given I have a simple page created at "hello-world" with the body:
|
Given I have a simple page at "hello-world" with the body:
|
||||||
"""
|
"""
|
||||||
Hello World
|
Hello World
|
||||||
"""
|
"""
|
||||||
@ -16,21 +16,20 @@ Feature: Engine
|
|||||||
Hello World
|
Hello World
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@wip
|
|
||||||
Scenario: Page with layout
|
Scenario: Page with layout
|
||||||
Given a layout named "above_and_below" with the content:
|
Given a layout named "above_and_below" with the body:
|
||||||
"""
|
"""
|
||||||
<div class="up_above"></div>
|
<div class="up_above"></div>
|
||||||
{{ content_for_layout }}
|
{{ content_for_layout }}
|
||||||
<div class="down_below"></div>
|
<div class="down_below"></div>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
And a page at "/hello_world_layout" with the layout "above_and_below" and the content:
|
And I have a simple page at "/hello-world-with-layout" with the layout "above_and_below" and the body:
|
||||||
"""
|
"""
|
||||||
Hello World
|
Hello World
|
||||||
"""
|
"""
|
||||||
|
|
||||||
When I render "/hello_world_layout"
|
When I view the rendered page at "/hello-world-with-layout"
|
||||||
Then the rendered output should look like:
|
Then the rendered output should look like:
|
||||||
"""
|
"""
|
||||||
<div class="up_above"></div>
|
<div class="up_above"></div>
|
||||||
|
@ -1,20 +1,35 @@
|
|||||||
### Pages
|
### Pages
|
||||||
|
|
||||||
Given /^I have a simple page created at "([^"]*)" with the body:$/ do |slug, page_contents|
|
Given /^I have a simple page at "([^"]*)" with the body:$/ do |page_slug, page_contents|
|
||||||
@page = Factory("content page", :site => @site, :slug => slug, :body => page_contents)
|
@page = Factory("content page", :slug => page_slug, :body => page_contents, :site => @site)
|
||||||
|
end
|
||||||
|
|
||||||
|
Given /^I have a simple page at "([^"]*)" 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 = Factory("content page", :slug => page_slug, :layout => layout, :body => page_contents, :site => @site)
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I view the rendered page at "([^"]*)"$/ do |slug|
|
When /^I view the rendered page at "([^"]*)"$/ do |slug|
|
||||||
visit "http://#{@site.domains.first}/#{slug}"
|
visit "http://#{@site.domains.first}/#{slug}"
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should have "(.*)" in the (.*) page (.*)$/ do |content, page_slug, slug|
|
Then /^I should have "(.*)" in the (.*) page (.*)$/ do |content, page_slug, part_slug|
|
||||||
page = @site.pages.where(:slug => page_slug).first
|
page = @site.pages.where(:slug => page_slug).first
|
||||||
part = page.parts.where(:slug => slug).first
|
raise "Could not find page: #{page_slug}" unless page
|
||||||
part.should_not be_nil
|
|
||||||
|
part = page.parts.where(:slug => part_slug).first
|
||||||
|
raise "Could not find part: #{part_slug} within page: #{page_slug}" unless part
|
||||||
|
|
||||||
part.value.should == content
|
part.value.should == content
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^the rendered output should look like:$/ do |body_contents|
|
Then /^the rendered output should look like:$/ do |body_contents|
|
||||||
page.body.should == body_contents
|
page.body.should == body_contents
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Given /^a layout named "([^"]*)" with the body:$/ do |layout_name, layout_body|
|
||||||
|
@layout = Factory(:layout, :name => layout_name, :value => layout_body, :site => @site)
|
||||||
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user