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

Commit

Permalink
not really committing anything, but git is complaining about changes …
Browse files Browse the repository at this point in the history
…being overwritten.
  • Loading branch information
James Cook committed Dec 30, 2008
1 parent 535eaa5 commit daef3f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/page.rb
Expand Up @@ -22,7 +22,7 @@
class Page < ActiveRecord::Base
include AASM
include ActionView::Helpers::DateHelper
named_scope :visible, lambda {|p| { :conditions => ["published = ? AND ( publish_at <= ? OR publish_at IS NULL )", true, Time.now.getgm ] } }
named_scope :visible, lambda {|p| { :conditions => ["published = ? AND (publish_at <= ? OR publish_at IS NULL )", true, Time.now.getgm] } }
named_scope :self_and_siblings, lambda {|page| {:conditions => ["parent_id = ?", page.parent_id], :order => 'page_order'}}

aasm_column :status
Expand Down
10 changes: 10 additions & 0 deletions spec/models/page_spec.rb
Expand Up @@ -22,6 +22,16 @@

end

describe "#visible" do
it "should return pages with publish_at values in the past or nil" do
# Rails is setting the publish_at values as nil when I specify the next two records in the fixtures file. What's up with that? -james
@visible_page = Page.create(:name => "Visible", :title => "I am visible", :publish_at => 1.days.ago )
@invisible_page = Page.create(:name => "Invisible", :title => "I am invisible", :publish_at => Time.now + 1.days )
Page.visible.find_by_name("Visible").should eql(@visible_page)
Page.visible.find_by_name("Invisible").should eql(nil)
end
end

describe '#full_title' do
it "should override title if it is a different value" do
@page = Page.find_by_name('home')
Expand Down

0 comments on commit daef3f2

Please sign in to comment.