Woohoo! Got a content page to render in the Cucumber tests

This commit is contained in:
Jacques Crocker 2010-08-01 05:00:34 -07:00
parent e31512dd97
commit 2b14c9c992
5 changed files with 11 additions and 10 deletions

View File

@ -1,11 +1,11 @@
### Pages
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
When /^I view the rendered page at "([^"]*)"$/ do |slug|
visit "/#{slug}"
visit "http://#{@site.domains.first}/#{slug}"
end
Then /^I should have "(.*)" in the (.*) page (.*)$/ do |content, page_slug, slug|

View File

@ -1,4 +1,6 @@
require 'database_cleaner'
require 'database_cleaner/cucumber'
Before do
DatabaseCleaner.clean
end
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = "mongoid"

View File

@ -11,7 +11,6 @@ module Locomotive
# see actionpack/lib/action_dispatch/http/url.rb for more information
def self.domain_and_subdomain(request)
subdomain = extract_subdomain(request)
[extract_domain(request), extract_subdomain(request)]
end

View File

@ -55,6 +55,12 @@ Factory.define :page do |p|
p.site { Site.where(:subdomain => "acme").first || Factory(:site) }
end
Factory.define "content page", :parent => :page do |p|
p.parent { |p| p.site.pages.where(:slug => "index").first }
end
# Factory.define "unpub"
## Liquid templates ##

View File

@ -20,13 +20,7 @@ Rspec.configure do |config|
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = "mongoid"
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end