Sha256: a0edd4800e3416e24b02c20f3f11cf28d3deaef9e56b2427f36adc923495a173
Contents?: true
Size: 714 Bytes
Versions: 18
Compression:
Stored size: 714 Bytes
Contents
require "spec_helper" describe Mongoid::Extensions::Proc::Scoping do describe "#scoped" do context "when the proc accessed a hash" do before do @proc = lambda { |number| { :where => { :count => number } } } end it "calls the hash with the args" do @proc.scoped(10).should == { :where => { :count => 10 } } end end context "when the proc calls a criteria" do before do @proc = lambda { |title| Person.where(:title => title) } end it "returns the criteria scoped" do @proc.scoped("Sir").should == { :where => { :_type => { "$in" => [ "Doctor", "Person" ] }, :title => "Sir" } } end end end end
Version data entries
18 entries across 18 versions & 2 rubygems