diff --git a/features/step_definitions/page_steps.rb b/features/step_definitions/page_steps.rb index 8a10795b..fa63e3f1 100644 --- a/features/step_definitions/page_steps.rb +++ b/features/step_definitions/page_steps.rb @@ -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| diff --git a/features/support/cleaner.rb b/features/support/cleaner.rb index b210de64..ddc9e7bf 100644 --- a/features/support/cleaner.rb +++ b/features/support/cleaner.rb @@ -1,4 +1,6 @@ require 'database_cleaner' -require 'database_cleaner/cucumber' +Before do + DatabaseCleaner.clean +end DatabaseCleaner.strategy = :truncation DatabaseCleaner.orm = "mongoid" \ No newline at end of file diff --git a/lib/locomotive/routing/default_constraint.rb b/lib/locomotive/routing/default_constraint.rb index 2ad5aad8..d3b15b2d 100644 --- a/lib/locomotive/routing/default_constraint.rb +++ b/lib/locomotive/routing/default_constraint.rb @@ -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 diff --git a/spec/factories.rb b/spec/factories.rb index bb4407f3..b2eff1d7 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -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 ## diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e996c426..7d86dc3a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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