Created
June 25, 2009 10:35
-
-
Save lmarburger/135781 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Video < ActiveRecord::Base | |
| default_scope :order => 'id DESC' | |
| named_scope :processed, :conditions => { :processed => true } | |
| named_scope :unprocessed, :conditions => { :processed => false } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| context 'Given videos' do | |
| setup do | |
| # Add some processed and unprocessed videos to the database. | |
| [ :uploaded_video, :processed_video ].each do |factory_type| | |
| 3.times { Factory(factory_type) } | |
| end | |
| end | |
| should 'sort newest videos first' do | |
| Video.all.should == Video.all(:order => 'id DESC') | |
| end | |
| should 'retrieve processed videos' do | |
| Video.processed.should == Video.all(:conditions => { :processed => true }) | |
| end | |
| should 'retrieve unprocessed videos' do | |
| Video.unprocessed.should == Video.all(:conditions => { :processed => false }) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment