Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

Commit

Permalink
added a test for Page.expired and dropped in a hack to prevent tests …
Browse files Browse the repository at this point in the history
…from aborting
  • Loading branch information
James Cook committed Jan 14, 2009
1 parent c1005f0 commit 2e20004
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/ansuz/plugin_manager.rb
Expand Up @@ -66,8 +66,9 @@ def register_page_type name, modules=[]

protected
def create_settings(name)
return false if SiteSetting.count == 0 # Stupid, mean hack. There's some test that clears site settings and breaks things.
site_setting = SiteSetting.first
unless( site_setting.settings[name])
unless( site_setting.nil? && site_setting.first.settings[name])
site_setting.settings[name] = {}
site_setting.save
end
Expand Down
7 changes: 7 additions & 0 deletions spec/fixtures/pages.yml
Expand Up @@ -92,5 +92,12 @@ swap_test3:
parent_id: 5
page_order: 4

expired:
id: 245
name: Expired
title: Expired test
parent_id: 5
page_order: 5
expires_on: <%= 2.days.ago %>


7 changes: 7 additions & 0 deletions spec/fixtures/site_settings.yml
@@ -0,0 +1,7 @@
default:
name: "Default Site"
user_theme_name: "Default Theme"
site_title: "My Default Site"
show_inline_edit_links: true


6 changes: 5 additions & 1 deletion spec/models/page_spec.rb
@@ -1,7 +1,7 @@
require File.dirname(__FILE__) + '/../spec_helper'

describe Page do
fixtures :pages
fixtures :pages, :site_settings

describe '#ancestor_path' do
it "should return / for the home page" do
Expand Down Expand Up @@ -30,6 +30,10 @@
Page.visible.find_by_name("Visible").should eql(@visible_page)
Page.visible.find_by_name("Invisible").should eql(nil)
end

it "should not include expired pages" do
Page.visible.find_by_name("Expired").should eql(nil)
end
end

describe '#full_title' do
Expand Down

0 comments on commit 2e20004

Please sign in to comment.