Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
- describe Announcement do
- before(:each) do
- @announcement = Announcement.new
- end
- #TODO these are weak/inaccurate specs. These are more-or-less stubs
- describe "the current_announcements" do
- it "should return announcements that are active" do
- time = Time.now.utc
- Announcement.active.should == Announcement.find(:all, :conditions => ['starts_at <= ? AND ends_at >= ?', time, time])
- end
- it "should return announcements since a time provided" do
- time = Time.now.utc
- Announcement.since.should == Announcement.find(
- :all,
- :conditions => (time ? ['updated_at > ? OR starts_at > ?', time.utc, time.utc] : nil))
- end
- it "should return announcements since a time provided (nil)" do
- time = nil
- Announcement.since.should == Announcement.find(
- :all,
- :conditions => (time ? ['updated_at > ? OR starts_at > ?', time.utc, time.utc] : nil))
- end
- end
- end
Add Comment
Please, Sign In to add comment