Sha256: 243bba02ff736f6954b5f43f0a39a896dc21066c27b6885e9c9f8bad6dd1cfd0
Contents?: true
Size: 856 Bytes
Versions: 5
Compression:
Stored size: 856 Bytes
Contents
require "spec_helper" describe Mongoid::NamedScope do describe ".named_scope" do class Person named_scope :doctors, {:where => {:title => 'Dr.'} } named_scope :old, criteria.where(:age.gt => 50) end before do @document = Person.create(:title => "Dr.", :age => 65, :terms => true) end after do Person.delete_all end context "accessing a single named scope" do it "returns the document" do Person.doctors.first.should == @document end end context "chaining named scopes" do it "returns the document" do Person.old.doctors.first.should == @document end end context "mixing named scopes and class methods" do it "returns the document" do Person.accepted.old.doctors.first.should == @document end end end end
Version data entries
5 entries across 5 versions & 1 rubygems