Guest User

Untitled

a guest
Feb 20th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
  2.  
  3. describe Announcement do
  4. before(:each) do
  5. @announcement = Announcement.new
  6. end
  7.  
  8. #TODO these are weak/inaccurate specs. These are more-or-less stubs
  9. describe "the current_announcements" do
  10. it "should return announcements that are active" do
  11. time = Time.now.utc
  12. Announcement.active.should == Announcement.find(:all, :conditions => ['starts_at <= ? AND ends_at >= ?', time, time])
  13. end
  14.  
  15. it "should return announcements since a time provided" do
  16. time = Time.now.utc
  17. Announcement.since.should == Announcement.find(
  18. :all,
  19. :conditions => (time ? ['updated_at > ? OR starts_at > ?', time.utc, time.utc] : nil))
  20. end
  21.  
  22. it "should return announcements since a time provided (nil)" do
  23. time = nil
  24. Announcement.since.should == Announcement.find(
  25. :all,
  26. :conditions => (time ? ['updated_at > ? OR starts_at > ?', time.utc, time.utc] : nil))
  27.  
  28. end
  29. end
  30. end
Add Comment
Please, Sign In to add comment