mongoid 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__), "/../../../../spec_helper.rb")
2
+
3
+ describe Mongoid::Extensions::Array::Conversions do
4
+
5
+ describe "#mongoidize" do
6
+
7
+ it "collects each of its attributes" do
8
+ array = [Person.new(:title => "Sir"), Person.new(:title => "Madam")]
9
+ array.mongoidize.should == [{ :title => "Sir" }, { :title => "Madam" }]
10
+ end
11
+
12
+ end
13
+
14
+ end
@@ -0,0 +1,13 @@
1
+ require File.join(File.dirname(__FILE__), "/../../../../spec_helper.rb")
2
+
3
+ describe Mongoid::Extensions::Object::Conversions do
4
+
5
+ describe "#mongoidize" do
6
+
7
+ it "returns its attributes" do
8
+ Person.new(:title => "Sir").mongoidize.should == { :title => "Sir" }
9
+ end
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,74 @@
1
+ require File.join(File.dirname(__FILE__), "/../../spec_helper.rb")
2
+
3
+ describe Mongoid::Paginator do
4
+
5
+ describe "#limit" do
6
+
7
+ context "when per_page is defined" do
8
+
9
+ before do
10
+ @options = { :per_page => 50 }
11
+ @paginator = Mongoid::Paginator.new(@options)
12
+ end
13
+
14
+ it "returns the per_page value" do
15
+ @paginator.limit.should == 50
16
+ end
17
+
18
+ end
19
+
20
+ context "when per_page is not defined" do
21
+
22
+ before do
23
+ @options = {}
24
+ @paginator = Mongoid::Paginator.new(@options)
25
+ end
26
+
27
+ it "returns the default of 20" do
28
+ @paginator.limit.should == 20
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+
35
+ describe "#offset" do
36
+
37
+ context "when page is defined" do
38
+
39
+ before do
40
+ @options = { :page => 11 }
41
+ @paginator = Mongoid::Paginator.new(@options)
42
+ end
43
+
44
+ it "returns the page value - 1 * limit" do
45
+ @paginator.offset.should == 200
46
+ end
47
+
48
+ end
49
+
50
+ context "when page is not defined" do
51
+
52
+ before do
53
+ @options = {}
54
+ @paginator = Mongoid::Paginator.new(@options)
55
+ end
56
+
57
+ it "returns the default of 0" do
58
+ @paginator.offset.should == 0
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+
65
+ describe "#options" do
66
+
67
+ it "returns a hash of the limit and offset" do
68
+ @paginator = Mongoid::Paginator.new
69
+ @paginator.options.should == { :limit => 20, :offset => 0 }
70
+ end
71
+
72
+ end
73
+
74
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mongoid
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.5
5
+ platform: ruby
6
+ authors:
7
+ - Durran Jordan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-01 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: mongodb-mongo
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ description:
36
+ email: durran@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - README.textile
43
+ files:
44
+ - .gitignore
45
+ - History.txt
46
+ - MIT_LICENSE
47
+ - README.textile
48
+ - Rakefile
49
+ - VERSION
50
+ - lib/mongoid.rb
51
+ - lib/mongoid/associations/association_factory.rb
52
+ - lib/mongoid/associations/belongs_to_association.rb
53
+ - lib/mongoid/associations/has_many_association.rb
54
+ - lib/mongoid/associations/has_one_association.rb
55
+ - lib/mongoid/document.rb
56
+ - lib/mongoid/extensions.rb
57
+ - lib/mongoid/extensions/array/conversions.rb
58
+ - lib/mongoid/extensions/object/conversions.rb
59
+ - lib/mongoid/paginator.rb
60
+ - mongoid.gemspec
61
+ - spec/integration/mongoid/document_spec.rb
62
+ - spec/spec.opts
63
+ - spec/spec_helper.rb
64
+ - spec/unit/mongoid/associations/association_factory_spec.rb
65
+ - spec/unit/mongoid/associations/belongs_to_association_spec.rb
66
+ - spec/unit/mongoid/associations/has_many_association_spec.rb
67
+ - spec/unit/mongoid/associations/has_one_association_spec.rb
68
+ - spec/unit/mongoid/document_spec.rb
69
+ - spec/unit/mongoid/extensions/array/conversions_spec.rb
70
+ - spec/unit/mongoid/extensions/object/conversions_spec.rb
71
+ - spec/unit/mongoid/paginator_spec.rb
72
+ has_rdoc: true
73
+ homepage: http://github.com/durran/mongoid
74
+ licenses: []
75
+
76
+ post_install_message:
77
+ rdoc_options:
78
+ - --charset=UTF-8
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: "0"
86
+ version:
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: "0"
92
+ version:
93
+ requirements: []
94
+
95
+ rubyforge_project:
96
+ rubygems_version: 1.3.5
97
+ signing_key:
98
+ specification_version: 3
99
+ summary: Mongoid
100
+ test_files:
101
+ - spec/integration/mongoid/document_spec.rb
102
+ - spec/spec_helper.rb
103
+ - spec/unit/mongoid/associations/association_factory_spec.rb
104
+ - spec/unit/mongoid/associations/belongs_to_association_spec.rb
105
+ - spec/unit/mongoid/associations/has_many_association_spec.rb
106
+ - spec/unit/mongoid/associations/has_one_association_spec.rb
107
+ - spec/unit/mongoid/document_spec.rb
108
+ - spec/unit/mongoid/extensions/array/conversions_spec.rb
109
+ - spec/unit/mongoid/extensions/object/conversions_spec.rb
110
+ - spec/unit/mongoid/paginator_spec.rb