Woohoo! Got a content page to render in the Cucumber tests
This commit is contained in:
parent
e31512dd97
commit
2b14c9c992
@ -1,11 +1,11 @@
|
|||||||
### Pages
|
### Pages
|
||||||
|
|
||||||
Given /^I have a simple page created at "([^"]*)" with the body:$/ do |slug, page_contents|
|
Given /^I have a simple page created at "([^"]*)" with the body:$/ do |slug, page_contents|
|
||||||
@page = Factory(:page, :site => @site, :slug => slug, :body => page_contents)
|
@page = Factory("content page", :site => @site, :slug => slug, :body => page_contents)
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I view the rendered page at "([^"]*)"$/ do |slug|
|
When /^I view the rendered page at "([^"]*)"$/ do |slug|
|
||||||
visit "/#{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, slug|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
require 'database_cleaner'
|
require 'database_cleaner'
|
||||||
require 'database_cleaner/cucumber'
|
Before do
|
||||||
|
DatabaseCleaner.clean
|
||||||
|
end
|
||||||
DatabaseCleaner.strategy = :truncation
|
DatabaseCleaner.strategy = :truncation
|
||||||
DatabaseCleaner.orm = "mongoid"
|
DatabaseCleaner.orm = "mongoid"
|
@ -11,7 +11,6 @@ module Locomotive
|
|||||||
|
|
||||||
# see actionpack/lib/action_dispatch/http/url.rb for more information
|
# see actionpack/lib/action_dispatch/http/url.rb for more information
|
||||||
def self.domain_and_subdomain(request)
|
def self.domain_and_subdomain(request)
|
||||||
subdomain = extract_subdomain(request)
|
|
||||||
[extract_domain(request), extract_subdomain(request)]
|
[extract_domain(request), extract_subdomain(request)]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -55,6 +55,12 @@ Factory.define :page do |p|
|
|||||||
p.site { Site.where(:subdomain => "acme").first || Factory(:site) }
|
p.site { Site.where(:subdomain => "acme").first || Factory(:site) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Factory.define "content page", :parent => :page do |p|
|
||||||
|
p.parent { |p| p.site.pages.where(:slug => "index").first }
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Factory.define "unpub"
|
# Factory.define "unpub"
|
||||||
|
|
||||||
## Liquid templates ##
|
## Liquid templates ##
|
||||||
|
@ -20,13 +20,7 @@ Rspec.configure do |config|
|
|||||||
DatabaseCleaner.strategy = :truncation
|
DatabaseCleaner.strategy = :truncation
|
||||||
DatabaseCleaner.orm = "mongoid"
|
DatabaseCleaner.orm = "mongoid"
|
||||||
end
|
end
|
||||||
|
|
||||||
config.before(:each) do
|
config.before(:each) do
|
||||||
DatabaseCleaner.start
|
|
||||||
end
|
|
||||||
|
|
||||||
config.after(:each) do
|
|
||||||
DatabaseCleaner.clean
|
DatabaseCleaner.clean
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user