This post originated from an RSS feed registered with Ruby Buzz
by Mike Gaffney.
Original Post: testing named scopes
Feed Title: confabulus
Feed URL: http://blog.confabulus.com/feed/
Feed Description: rails, coding, and the goings on at confabulus
Named scopes are a nice feature that came out in rails 2.1, however, testing them is not very obvious.
Say we have a named scope in our member object which looks like this:
class Member < ActiveRecord::Base
named_scope :active, {:conditions => {:status => Member::STATUS_ACTIVE}}
end
There are 2 things we need to do to test them.
First would [...]