mongoid 0.5.11 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.11
1
+ 0.6.0
@@ -309,8 +309,9 @@ module Mongoid #:nodoc:
309
309
  #
310
310
  # Returns a new +Criteria+ object.
311
311
  def self.translate(*args)
312
- type, params = args[0], args[1] || {}
313
- return new(:first).id(type) unless type.is_a?(Symbol)
312
+ type = args[0] || :all
313
+ params = args[1] || {}
314
+ return new(:first).id(args[0]) unless type.is_a?(Symbol)
314
315
  return new(type).where(params.delete(:conditions)).extras(params)
315
316
  end
316
317
 
data/mongoid.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongoid}
8
- s.version = "0.5.11"
8
+ s.version = "0.6.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Durran Jordan"]
@@ -15,6 +15,18 @@ describe Mongoid::Document do
15
15
 
16
16
  end
17
17
 
18
+ describe "#count" do
19
+
20
+ before do
21
+ Person.create(:title => "Sir")
22
+ end
23
+
24
+ it "returns the count" do
25
+ Person.count.should == 1
26
+ end
27
+
28
+ end
29
+
18
30
  describe "#create" do
19
31
 
20
32
  it "persists a new record to the database" do
@@ -122,6 +122,16 @@ describe Mongoid::Document do
122
122
  Person.count(@params).should == 10
123
123
  end
124
124
 
125
+ context "when no options provided" do
126
+
127
+ it "adds in the default parameters" do
128
+ Mongoid::Criteria.expects(:translate).with(nil).returns(@criteria)
129
+ @criteria.expects(:count).with(Person).returns(10)
130
+ Person.count.should == 10
131
+ end
132
+
133
+ end
134
+
125
135
  end
126
136
 
127
137
  describe "#field" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.11
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Durran Jordan