tried to find but with no success. Just wondering how could I test scopes in Rails 3.
Could be using rspec, shoulda or just a test unit.
Thanks.
Actually, I trying this way, but it's not complete test since it's still need to put the order() method.
The Scope:
scope :recents_available, where(:available => true, :locked => false).order("created_at DESC")
describe Job, ":recents_available" do
it "should have the scope" do
Job.should respond_to(:recents_available)
end
it "should include recents jobs that are available and unlocked" do
@job = Factory(:job, :available => true, :locked => false )
Job.recents_available.should include(@job)
end
end