mongoid-locomotive 2.0.0.beta9
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.
- data/MIT_LICENSE +20 -0
- data/README.rdoc +47 -0
- data/lib/mongoid.rb +141 -0
- data/lib/mongoid/associations.rb +306 -0
- data/lib/mongoid/associations/embedded_in.rb +74 -0
- data/lib/mongoid/associations/embeds_many.rb +280 -0
- data/lib/mongoid/associations/embeds_one.rb +97 -0
- data/lib/mongoid/associations/foreign_key.rb +35 -0
- data/lib/mongoid/associations/meta_data.rb +38 -0
- data/lib/mongoid/associations/options.rb +62 -0
- data/lib/mongoid/associations/proxy.rb +33 -0
- data/lib/mongoid/associations/referenced_in.rb +59 -0
- data/lib/mongoid/associations/references_many.rb +245 -0
- data/lib/mongoid/associations/references_many_as_array.rb +78 -0
- data/lib/mongoid/associations/references_one.rb +99 -0
- data/lib/mongoid/atomicity.rb +55 -0
- data/lib/mongoid/attributes.rb +242 -0
- data/lib/mongoid/callbacks.rb +21 -0
- data/lib/mongoid/collection.rb +120 -0
- data/lib/mongoid/collections.rb +71 -0
- data/lib/mongoid/collections/cyclic_iterator.rb +34 -0
- data/lib/mongoid/collections/master.rb +29 -0
- data/lib/mongoid/collections/operations.rb +41 -0
- data/lib/mongoid/collections/slaves.rb +45 -0
- data/lib/mongoid/components.rb +34 -0
- data/lib/mongoid/config.rb +263 -0
- data/lib/mongoid/contexts.rb +24 -0
- data/lib/mongoid/contexts/enumerable.rb +156 -0
- data/lib/mongoid/contexts/ids.rb +25 -0
- data/lib/mongoid/contexts/mongo.rb +285 -0
- data/lib/mongoid/contexts/paging.rb +50 -0
- data/lib/mongoid/criteria.rb +248 -0
- data/lib/mongoid/criterion/complex.rb +21 -0
- data/lib/mongoid/criterion/exclusion.rb +65 -0
- data/lib/mongoid/criterion/inclusion.rb +110 -0
- data/lib/mongoid/criterion/optional.rb +189 -0
- data/lib/mongoid/cursor.rb +81 -0
- data/lib/mongoid/deprecation.rb +21 -0
- data/lib/mongoid/dirty.rb +252 -0
- data/lib/mongoid/document.rb +210 -0
- data/lib/mongoid/errors.rb +131 -0
- data/lib/mongoid/extensions.rb +115 -0
- data/lib/mongoid/extensions/array/accessors.rb +17 -0
- data/lib/mongoid/extensions/array/assimilation.rb +26 -0
- data/lib/mongoid/extensions/array/conversions.rb +23 -0
- data/lib/mongoid/extensions/array/parentization.rb +13 -0
- data/lib/mongoid/extensions/big_decimal/conversions.rb +19 -0
- data/lib/mongoid/extensions/binary/conversions.rb +17 -0
- data/lib/mongoid/extensions/boolean/conversions.rb +27 -0
- data/lib/mongoid/extensions/date/conversions.rb +24 -0
- data/lib/mongoid/extensions/datetime/conversions.rb +12 -0
- data/lib/mongoid/extensions/false_class/equality.rb +13 -0
- data/lib/mongoid/extensions/float/conversions.rb +20 -0
- data/lib/mongoid/extensions/hash/accessors.rb +42 -0
- data/lib/mongoid/extensions/hash/assimilation.rb +40 -0
- data/lib/mongoid/extensions/hash/conversions.rb +42 -0
- data/lib/mongoid/extensions/hash/criteria_helpers.rb +20 -0
- data/lib/mongoid/extensions/hash/scoping.rb +12 -0
- data/lib/mongoid/extensions/integer/conversions.rb +20 -0
- data/lib/mongoid/extensions/nil/assimilation.rb +17 -0
- data/lib/mongoid/extensions/object/conversions.rb +21 -0
- data/lib/mongoid/extensions/objectid/conversions.rb +15 -0
- data/lib/mongoid/extensions/proc/scoping.rb +12 -0
- data/lib/mongoid/extensions/set/conversions.rb +20 -0
- data/lib/mongoid/extensions/string/conversions.rb +15 -0
- data/lib/mongoid/extensions/string/inflections.rb +97 -0
- data/lib/mongoid/extensions/symbol/inflections.rb +40 -0
- data/lib/mongoid/extensions/time_conversions.rb +35 -0
- data/lib/mongoid/extensions/true_class/equality.rb +13 -0
- data/lib/mongoid/extras.rb +61 -0
- data/lib/mongoid/factory.rb +20 -0
- data/lib/mongoid/field.rb +83 -0
- data/lib/mongoid/fields.rb +62 -0
- data/lib/mongoid/finders.rb +145 -0
- data/lib/mongoid/hierarchy.rb +74 -0
- data/lib/mongoid/identity.rb +47 -0
- data/lib/mongoid/indexes.rb +27 -0
- data/lib/mongoid/javascript.rb +21 -0
- data/lib/mongoid/javascript/functions.yml +37 -0
- data/lib/mongoid/logger.rb +19 -0
- data/lib/mongoid/matchers.rb +35 -0
- data/lib/mongoid/matchers/all.rb +11 -0
- data/lib/mongoid/matchers/default.rb +26 -0
- data/lib/mongoid/matchers/exists.rb +13 -0
- data/lib/mongoid/matchers/gt.rb +11 -0
- data/lib/mongoid/matchers/gte.rb +11 -0
- data/lib/mongoid/matchers/in.rb +11 -0
- data/lib/mongoid/matchers/lt.rb +11 -0
- data/lib/mongoid/matchers/lte.rb +11 -0
- data/lib/mongoid/matchers/ne.rb +11 -0
- data/lib/mongoid/matchers/nin.rb +11 -0
- data/lib/mongoid/matchers/size.rb +11 -0
- data/lib/mongoid/memoization.rb +33 -0
- data/lib/mongoid/named_scope.rb +37 -0
- data/lib/mongoid/paranoia.rb +106 -0
- data/lib/mongoid/paths.rb +61 -0
- data/lib/mongoid/persistence.rb +216 -0
- data/lib/mongoid/persistence/command.rb +39 -0
- data/lib/mongoid/persistence/insert.rb +48 -0
- data/lib/mongoid/persistence/insert_embedded.rb +44 -0
- data/lib/mongoid/persistence/remove.rb +39 -0
- data/lib/mongoid/persistence/remove_all.rb +38 -0
- data/lib/mongoid/persistence/remove_embedded.rb +50 -0
- data/lib/mongoid/persistence/update.rb +71 -0
- data/lib/mongoid/railtie.rb +67 -0
- data/lib/mongoid/railties/database.rake +60 -0
- data/lib/mongoid/scope.rb +75 -0
- data/lib/mongoid/state.rb +32 -0
- data/lib/mongoid/timestamps.rb +27 -0
- data/lib/mongoid/validations.rb +51 -0
- data/lib/mongoid/validations/associated.rb +32 -0
- data/lib/mongoid/validations/locale/en.yml +5 -0
- data/lib/mongoid/validations/uniqueness.rb +56 -0
- data/lib/mongoid/version.rb +4 -0
- data/lib/mongoid/versioning.rb +26 -0
- data/lib/rails/generators/mongoid/config/config_generator.rb +25 -0
- data/lib/rails/generators/mongoid/config/templates/mongoid.yml +24 -0
- data/lib/rails/generators/mongoid/model/model_generator.rb +24 -0
- data/lib/rails/generators/mongoid/model/templates/model.rb +15 -0
- data/lib/rails/generators/mongoid_generator.rb +61 -0
- data/spec/integration/mongoid/association_attributes_spec.rb +71 -0
- data/spec/integration/mongoid/associations_spec.rb +768 -0
- data/spec/integration/mongoid/attributes_spec.rb +59 -0
- data/spec/integration/mongoid/callback_spec.rb +33 -0
- data/spec/integration/mongoid/contexts/enumerable_spec.rb +33 -0
- data/spec/integration/mongoid/criteria_spec.rb +281 -0
- data/spec/integration/mongoid/dirty_spec.rb +85 -0
- data/spec/integration/mongoid/document_spec.rb +741 -0
- data/spec/integration/mongoid/extensions_spec.rb +22 -0
- data/spec/integration/mongoid/finders_spec.rb +119 -0
- data/spec/integration/mongoid/inheritance_spec.rb +171 -0
- data/spec/integration/mongoid/named_scope_spec.rb +58 -0
- data/spec/integration/mongoid/paranoia_spec.rb +44 -0
- data/spec/integration/mongoid/persistence/update_spec.rb +46 -0
- data/spec/integration/mongoid/persistence_spec.rb +311 -0
- data/spec/integration/mongoid/validations/uniqueness_spec.rb +206 -0
- data/spec/models/account.rb +5 -0
- data/spec/models/address.rb +40 -0
- data/spec/models/agent.rb +7 -0
- data/spec/models/animal.rb +15 -0
- data/spec/models/answer.rb +4 -0
- data/spec/models/callbacks.rb +47 -0
- data/spec/models/category.rb +13 -0
- data/spec/models/comment.rb +10 -0
- data/spec/models/country_code.rb +6 -0
- data/spec/models/employer.rb +5 -0
- data/spec/models/favorite.rb +8 -0
- data/spec/models/game.rb +9 -0
- data/spec/models/inheritance.rb +72 -0
- data/spec/models/location.rb +5 -0
- data/spec/models/login.rb +6 -0
- data/spec/models/mixed_drink.rb +4 -0
- data/spec/models/name.rb +13 -0
- data/spec/models/namespacing.rb +11 -0
- data/spec/models/paranoid_post.rb +18 -0
- data/spec/models/parents.rb +32 -0
- data/spec/models/patient.rb +15 -0
- data/spec/models/person.rb +106 -0
- data/spec/models/pet.rb +7 -0
- data/spec/models/pet_owner.rb +6 -0
- data/spec/models/phone.rb +7 -0
- data/spec/models/post.rb +25 -0
- data/spec/models/preference.rb +7 -0
- data/spec/models/question.rb +8 -0
- data/spec/models/survey.rb +6 -0
- data/spec/models/translation.rb +5 -0
- data/spec/models/user.rb +6 -0
- data/spec/models/user_accout.rb +5 -0
- data/spec/models/vet_visit.rb +5 -0
- data/spec/models/video.rb +5 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/unit/mongoid/associations/embedded_in_spec.rb +193 -0
- data/spec/unit/mongoid/associations/embeds_many_spec.rb +626 -0
- data/spec/unit/mongoid/associations/embeds_one_spec.rb +287 -0
- data/spec/unit/mongoid/associations/foreign_key_spec.rb +90 -0
- data/spec/unit/mongoid/associations/meta_data_spec.rb +110 -0
- data/spec/unit/mongoid/associations/options_spec.rb +215 -0
- data/spec/unit/mongoid/associations/referenced_in_spec.rb +145 -0
- data/spec/unit/mongoid/associations/references_many_as_array_spec.rb +424 -0
- data/spec/unit/mongoid/associations/references_many_spec.rb +502 -0
- data/spec/unit/mongoid/associations/references_one_spec.rb +204 -0
- data/spec/unit/mongoid/associations_spec.rb +688 -0
- data/spec/unit/mongoid/atomicity_spec.rb +164 -0
- data/spec/unit/mongoid/attributes_spec.rb +646 -0
- data/spec/unit/mongoid/callbacks_spec.rb +85 -0
- data/spec/unit/mongoid/collection_spec.rb +187 -0
- data/spec/unit/mongoid/collections/cyclic_iterator_spec.rb +75 -0
- data/spec/unit/mongoid/collections/master_spec.rb +41 -0
- data/spec/unit/mongoid/collections/slaves_spec.rb +81 -0
- data/spec/unit/mongoid/collections_spec.rb +98 -0
- data/spec/unit/mongoid/config_spec.rb +298 -0
- data/spec/unit/mongoid/contexts/enumerable_spec.rb +447 -0
- data/spec/unit/mongoid/contexts/mongo_spec.rb +703 -0
- data/spec/unit/mongoid/contexts_spec.rb +25 -0
- data/spec/unit/mongoid/criteria_spec.rb +873 -0
- data/spec/unit/mongoid/criterion/complex_spec.rb +17 -0
- data/spec/unit/mongoid/criterion/exclusion_spec.rb +121 -0
- data/spec/unit/mongoid/criterion/inclusion_spec.rb +274 -0
- data/spec/unit/mongoid/criterion/optional_spec.rb +483 -0
- data/spec/unit/mongoid/cursor_spec.rb +80 -0
- data/spec/unit/mongoid/deprecation_spec.rb +24 -0
- data/spec/unit/mongoid/dirty_spec.rb +430 -0
- data/spec/unit/mongoid/document_spec.rb +623 -0
- data/spec/unit/mongoid/errors_spec.rb +154 -0
- data/spec/unit/mongoid/extensions/array/accessors_spec.rb +50 -0
- data/spec/unit/mongoid/extensions/array/assimilation_spec.rb +24 -0
- data/spec/unit/mongoid/extensions/array/conversions_spec.rb +52 -0
- data/spec/unit/mongoid/extensions/array/parentization_spec.rb +20 -0
- data/spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb +36 -0
- data/spec/unit/mongoid/extensions/binary/conversions_spec.rb +22 -0
- data/spec/unit/mongoid/extensions/boolean/conversions_spec.rb +49 -0
- data/spec/unit/mongoid/extensions/date/conversions_spec.rb +145 -0
- data/spec/unit/mongoid/extensions/datetime/conversions_spec.rb +14 -0
- data/spec/unit/mongoid/extensions/false_class/equality_spec.rb +35 -0
- data/spec/unit/mongoid/extensions/float/conversions_spec.rb +61 -0
- data/spec/unit/mongoid/extensions/hash/accessors_spec.rb +184 -0
- data/spec/unit/mongoid/extensions/hash/assimilation_spec.rb +59 -0
- data/spec/unit/mongoid/extensions/hash/conversions_spec.rb +35 -0
- data/spec/unit/mongoid/extensions/hash/criteria_helpers_spec.rb +17 -0
- data/spec/unit/mongoid/extensions/hash/scoping_spec.rb +14 -0
- data/spec/unit/mongoid/extensions/integer/conversions_spec.rb +61 -0
- data/spec/unit/mongoid/extensions/nil/assimilation_spec.rb +29 -0
- data/spec/unit/mongoid/extensions/object/conversions_spec.rb +44 -0
- data/spec/unit/mongoid/extensions/objectid/conversions_spec.rb +22 -0
- data/spec/unit/mongoid/extensions/proc/scoping_spec.rb +34 -0
- data/spec/unit/mongoid/extensions/set/conversions_spec.rb +21 -0
- data/spec/unit/mongoid/extensions/string/conversions_spec.rb +28 -0
- data/spec/unit/mongoid/extensions/string/inflections_spec.rb +208 -0
- data/spec/unit/mongoid/extensions/symbol/inflections_spec.rb +107 -0
- data/spec/unit/mongoid/extensions/time_conversions_spec.rb +186 -0
- data/spec/unit/mongoid/extensions/true_class/equality_spec.rb +35 -0
- data/spec/unit/mongoid/extras_spec.rb +102 -0
- data/spec/unit/mongoid/factory_spec.rb +31 -0
- data/spec/unit/mongoid/field_spec.rb +169 -0
- data/spec/unit/mongoid/fields_spec.rb +181 -0
- data/spec/unit/mongoid/finders_spec.rb +439 -0
- data/spec/unit/mongoid/hierarchy_spec.rb +68 -0
- data/spec/unit/mongoid/identity_spec.rb +109 -0
- data/spec/unit/mongoid/indexes_spec.rb +99 -0
- data/spec/unit/mongoid/javascript_spec.rb +48 -0
- data/spec/unit/mongoid/logger_spec.rb +38 -0
- data/spec/unit/mongoid/matchers/all_spec.rb +27 -0
- data/spec/unit/mongoid/matchers/default_spec.rb +27 -0
- data/spec/unit/mongoid/matchers/exists_spec.rb +56 -0
- data/spec/unit/mongoid/matchers/gt_spec.rb +39 -0
- data/spec/unit/mongoid/matchers/gte_spec.rb +49 -0
- data/spec/unit/mongoid/matchers/in_spec.rb +27 -0
- data/spec/unit/mongoid/matchers/lt_spec.rb +39 -0
- data/spec/unit/mongoid/matchers/lte_spec.rb +49 -0
- data/spec/unit/mongoid/matchers/ne_spec.rb +27 -0
- data/spec/unit/mongoid/matchers/nin_spec.rb +27 -0
- data/spec/unit/mongoid/matchers/size_spec.rb +27 -0
- data/spec/unit/mongoid/matchers_spec.rb +329 -0
- data/spec/unit/mongoid/memoization_spec.rb +75 -0
- data/spec/unit/mongoid/named_scope_spec.rb +123 -0
- data/spec/unit/mongoid/paranoia_spec.rb +108 -0
- data/spec/unit/mongoid/paths_spec.rb +272 -0
- data/spec/unit/mongoid/persistence/insert_embedded_spec.rb +154 -0
- data/spec/unit/mongoid/persistence/insert_spec.rb +144 -0
- data/spec/unit/mongoid/persistence/remove_all_spec.rb +82 -0
- data/spec/unit/mongoid/persistence/remove_embedded_spec.rb +152 -0
- data/spec/unit/mongoid/persistence/remove_spec.rb +89 -0
- data/spec/unit/mongoid/persistence/update_spec.rb +177 -0
- data/spec/unit/mongoid/persistence_spec.rb +452 -0
- data/spec/unit/mongoid/scope_spec.rb +240 -0
- data/spec/unit/mongoid/serialization_spec.rb +43 -0
- data/spec/unit/mongoid/state_spec.rb +94 -0
- data/spec/unit/mongoid/timestamps_spec.rb +30 -0
- data/spec/unit/mongoid/validations/associated_spec.rb +103 -0
- data/spec/unit/mongoid/validations/uniqueness_spec.rb +201 -0
- data/spec/unit/mongoid/validations_spec.rb +43 -0
- data/spec/unit/mongoid/versioning_spec.rb +41 -0
- data/spec/unit/mongoid_spec.rb +46 -0
- metadata +433 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe Mongoid::Validations::UniquenessValidator do
|
|
4
|
+
|
|
5
|
+
describe "#validate_each" do
|
|
6
|
+
|
|
7
|
+
before do
|
|
8
|
+
@document = Person.new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
let(:validator) { Mongoid::Validations::UniquenessValidator.new(:attributes => @document.attributes) }
|
|
12
|
+
|
|
13
|
+
context "when a document exists with the attribute value" do
|
|
14
|
+
|
|
15
|
+
before do
|
|
16
|
+
@criteria = stub(:exists? => true)
|
|
17
|
+
Person.expects(:where).with(:title => "Sir").returns(@criteria)
|
|
18
|
+
validator.setup(Person)
|
|
19
|
+
validator.validate_each(@document, :title, "Sir")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "adds the errors to the document" do
|
|
23
|
+
@document.errors[:title].should_not be_empty
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should translate the error in english" do
|
|
27
|
+
@document.errors[:title][0].should == "is already taken"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
context "when a superclass document exists with the attribute value" do
|
|
32
|
+
before do
|
|
33
|
+
@drdocument = Doctor.new
|
|
34
|
+
@criteria = stub(:exists? => true)
|
|
35
|
+
Person.expects(:where).with(:title => "Sir").returns(@criteria)
|
|
36
|
+
validator.setup(Person)
|
|
37
|
+
validator.validate_each(@drdocument, :title, "Sir")
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "adds the errors to the document" do
|
|
41
|
+
@drdocument.errors[:title].should_not be_empty
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
context "when no other document exists with the attribute value" do
|
|
46
|
+
|
|
47
|
+
before do
|
|
48
|
+
@criteria = stub(:exists? => false)
|
|
49
|
+
Person.expects(:where).with(:title => "Sir").returns(@criteria)
|
|
50
|
+
validator.setup(Person)
|
|
51
|
+
validator.validate_each(@document, :title, "Sir")
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it "adds no errors" do
|
|
55
|
+
@document.errors[:title].should be_empty
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
context "when defining a single field key" do
|
|
60
|
+
|
|
61
|
+
context "when a document exists in the db with the same key" do
|
|
62
|
+
|
|
63
|
+
context "when the document being validated is new" do
|
|
64
|
+
|
|
65
|
+
let(:login) do
|
|
66
|
+
Login.new(:username => "chitchins")
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
before do
|
|
70
|
+
@criteria = stub(:exists? => true)
|
|
71
|
+
Login.expects(:where).with(:username => "chitchins").returns(@criteria)
|
|
72
|
+
validator.setup(Login)
|
|
73
|
+
validator.validate_each(login, :username, "chitchins")
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "checks the value of the key field" do
|
|
77
|
+
login.errors[:username].should_not be_empty
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
context "when the document being validated is not new" do
|
|
82
|
+
|
|
83
|
+
context "when the id has not changed since instantiation" do
|
|
84
|
+
|
|
85
|
+
let(:login) do
|
|
86
|
+
login = Login.new(:username => "chitchins")
|
|
87
|
+
login.instance_variable_set(:@new_record, false)
|
|
88
|
+
login
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
before do
|
|
92
|
+
@criteria = stub(:exists? => false)
|
|
93
|
+
Login.expects(:where).with(:username => "chitchins").returns(@criteria)
|
|
94
|
+
@criteria.expects(:where).with(:_id => {'$ne' => 'chitchins'}).returns(@criteria)
|
|
95
|
+
validator.setup(Login)
|
|
96
|
+
validator.validate_each(login, :username, "chitchins")
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
it "checks the value of the key field" do
|
|
100
|
+
login.errors[:username].should be_empty
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
context "when the id has changed since instantiation" do
|
|
105
|
+
|
|
106
|
+
let(:login) do
|
|
107
|
+
login = Login.new(:username => "rdawkins")
|
|
108
|
+
login.instance_variable_set(:@new_record, false)
|
|
109
|
+
login.username = "chitchins"
|
|
110
|
+
login
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
before do
|
|
114
|
+
@criteria = stub(:exists? => true)
|
|
115
|
+
Login.expects(:where).with(:username => "chitchins").returns(@criteria)
|
|
116
|
+
@criteria.expects(:where).with(:_id => {'$ne' => 'rdawkins'}).returns(@criteria)
|
|
117
|
+
validator.setup(Login)
|
|
118
|
+
validator.validate_each(login, :username, "chitchins")
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it "checks the value of the key field" do
|
|
122
|
+
login.errors[:username].should_not be_empty
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
describe "#validate_each with embedded document" do
|
|
131
|
+
|
|
132
|
+
context "embeds_many" do
|
|
133
|
+
let(:person) { Person.new }
|
|
134
|
+
let(:favorite) { person.favorites.build(:title => "pizza") }
|
|
135
|
+
let(:validator) { Mongoid::Validations::UniquenessValidator.new(:attributes => favorite.attributes) }
|
|
136
|
+
let(:criteria) { stub(:exists? => false) }
|
|
137
|
+
|
|
138
|
+
it "excludes by attribute and id" do
|
|
139
|
+
person.favorites.expects(:where).with(:title => "pizza", :_id => {'$ne' => favorite.id}).returns(criteria)
|
|
140
|
+
validator.setup(Favorite)
|
|
141
|
+
validator.validate_each(favorite, :title, "pizza")
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
context "embeds_one" do
|
|
145
|
+
let(:person) { Patient.new }
|
|
146
|
+
let(:email) { Email.new(:address => "joe@example.com", :person => person) }
|
|
147
|
+
let(:validator) { Mongoid::Validations::UniquenessValidator.new(:attributes => email.attributes) }
|
|
148
|
+
|
|
149
|
+
it "no validations are run" do
|
|
150
|
+
email.expects(:where).never
|
|
151
|
+
validator.setup(Email)
|
|
152
|
+
validator.validate_each(email, :address, "joe@example.com")
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
context "when document has no parent" do
|
|
156
|
+
let(:person) { stub.quacks_like(nil) }
|
|
157
|
+
it "no validations are run" do
|
|
158
|
+
person.expects(:address).never
|
|
159
|
+
validator.setup(Email)
|
|
160
|
+
validator.validate_each(email, :address, "joe@example.com")
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
describe "#validate_each with :scope option given" do
|
|
167
|
+
|
|
168
|
+
before do
|
|
169
|
+
@document = Person.new(:employer_id => 3, :terms => true, :title => "")
|
|
170
|
+
@criteria = stub(:exists? => false)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
describe "as a symbol" do
|
|
174
|
+
|
|
175
|
+
let(:validator) { Mongoid::Validations::UniquenessValidator.new(:attributes => @document.attributes,
|
|
176
|
+
:scope => :employer_id) }
|
|
177
|
+
|
|
178
|
+
it "should query only scoped documents" do
|
|
179
|
+
Person.expects(:where).with(:title => "Sir").returns(@criteria)
|
|
180
|
+
@criteria.expects(:where).with(:employer_id => @document.attributes[:employer_id]).returns(@criteria)
|
|
181
|
+
validator.setup(Person)
|
|
182
|
+
validator.validate_each(@document, :title, "Sir")
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
describe "as an array" do
|
|
188
|
+
|
|
189
|
+
let(:validator) { Mongoid::Validations::UniquenessValidator.new(:attributes => @document.attributes,
|
|
190
|
+
:scope => [:employer_id, :terms]) }
|
|
191
|
+
it "should query only scoped documents" do
|
|
192
|
+
Person.expects(:where).with(:title => "Sir").returns(@criteria)
|
|
193
|
+
@criteria.expects(:where).with(:employer_id => @document.attributes[:employer_id]).returns(@criteria)
|
|
194
|
+
@criteria.expects(:where).with(:terms => true).returns(@criteria)
|
|
195
|
+
validator.setup(Person)
|
|
196
|
+
validator.validate_each(@document, :title, "Sir")
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe Mongoid::Validations do
|
|
4
|
+
|
|
5
|
+
before(:all) do
|
|
6
|
+
Person.logger = nil
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe ".validates_associated" do
|
|
10
|
+
|
|
11
|
+
before do
|
|
12
|
+
@class = MixedDrink
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "adds the associated validator" do
|
|
16
|
+
@class.expects(:validates_with).with(Mongoid::Validations::AssociatedValidator, { :attributes => [ :name ] })
|
|
17
|
+
@class.validates_associated(:name)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "is picked up by validates method" do
|
|
21
|
+
@class.expects(:validates_with).with(Mongoid::Validations::AssociatedValidator, { :attributes => [ :name ] })
|
|
22
|
+
@class.validates(:name, :associated => true)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe ".validates_uniqueness_of" do
|
|
28
|
+
|
|
29
|
+
before do
|
|
30
|
+
@class = MixedDrink
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "adds the uniqueness validator" do
|
|
34
|
+
@class.expects(:validates_with).with(Mongoid::Validations::UniquenessValidator, { :attributes => [ :title ] })
|
|
35
|
+
@class.validates_uniqueness_of(:title)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "is picked up by validates method" do
|
|
39
|
+
@class.expects(:validates_with).with(Mongoid::Validations::UniquenessValidator, { :attributes => [ :title ] })
|
|
40
|
+
@class.validates(:title, :uniqueness => true)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe Mongoid::Versioning do
|
|
4
|
+
|
|
5
|
+
describe "#version" do
|
|
6
|
+
|
|
7
|
+
before do
|
|
8
|
+
@post = Post.new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "defaults to 1" do
|
|
12
|
+
@post.version.should == 1
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
context "when document is saved" do
|
|
16
|
+
|
|
17
|
+
before do
|
|
18
|
+
@post.title = "New"
|
|
19
|
+
@version = Post.new(:title => "Test")
|
|
20
|
+
Post.expects(:first).at_least(1).with(:conditions => { :_id => @post.id, :version => 1 }).returns(@version)
|
|
21
|
+
@post.revise
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "increments the version" do
|
|
25
|
+
@post.version.should == 2
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "adds a snapshot of the document to the versions" do
|
|
29
|
+
@post.title.should == "New"
|
|
30
|
+
@post.version.should == 2
|
|
31
|
+
@post.versions.size.should == 1
|
|
32
|
+
version = @post.versions.first
|
|
33
|
+
version.title.should == "Test"
|
|
34
|
+
version.version.should == 1
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe Mongoid do
|
|
4
|
+
|
|
5
|
+
describe ".configure" do
|
|
6
|
+
|
|
7
|
+
context "when no block supplied" do
|
|
8
|
+
|
|
9
|
+
it "returns the config singleton" do
|
|
10
|
+
Mongoid.configure.should == Mongoid::Config.instance
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
context "when a block is supplied" do
|
|
15
|
+
|
|
16
|
+
before do
|
|
17
|
+
Mongoid.configure do |config|
|
|
18
|
+
config.allow_dynamic_fields = false
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
after do
|
|
23
|
+
Mongoid.configure do |config|
|
|
24
|
+
config.allow_dynamic_fields = true
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "sets the values on the config instance" do
|
|
29
|
+
Mongoid.allow_dynamic_fields.should be_false
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe ".deprecate" do
|
|
35
|
+
let(:deprecation) { stub }
|
|
36
|
+
|
|
37
|
+
before do
|
|
38
|
+
Mongoid::Deprecation.expects(:instance).returns(deprecation)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "calls alert on the deprecation singleton" do
|
|
42
|
+
deprecation.expects(:alert).with("testing")
|
|
43
|
+
Mongoid.deprecate("testing")
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mongoid-locomotive
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
prerelease: true
|
|
5
|
+
segments:
|
|
6
|
+
- 2
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- beta9
|
|
10
|
+
version: 2.0.0.beta9
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- Durran Jordan
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2010-07-20 00:00:00 +02:00
|
|
19
|
+
default_executable:
|
|
20
|
+
dependencies:
|
|
21
|
+
- !ruby/object:Gem::Dependency
|
|
22
|
+
prerelease: false
|
|
23
|
+
name: bundler
|
|
24
|
+
type: :runtime
|
|
25
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
segments:
|
|
30
|
+
- 0
|
|
31
|
+
version: "0"
|
|
32
|
+
requirement: *id001
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
prerelease: false
|
|
35
|
+
name: activemodel
|
|
36
|
+
type: :runtime
|
|
37
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ~>
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
segments:
|
|
42
|
+
- 3
|
|
43
|
+
- 0
|
|
44
|
+
- 0
|
|
45
|
+
- beta
|
|
46
|
+
version: 3.0.0.beta
|
|
47
|
+
requirement: *id002
|
|
48
|
+
- !ruby/object:Gem::Dependency
|
|
49
|
+
prerelease: false
|
|
50
|
+
name: tzinfo
|
|
51
|
+
type: :runtime
|
|
52
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - ~>
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
segments:
|
|
57
|
+
- 0
|
|
58
|
+
- 3
|
|
59
|
+
- 22
|
|
60
|
+
version: 0.3.22
|
|
61
|
+
requirement: *id003
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
63
|
+
prerelease: false
|
|
64
|
+
name: will_paginate
|
|
65
|
+
type: :runtime
|
|
66
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
|
67
|
+
requirements:
|
|
68
|
+
- - ~>
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
segments:
|
|
71
|
+
- 3
|
|
72
|
+
- 0
|
|
73
|
+
- pre
|
|
74
|
+
version: 3.0.pre
|
|
75
|
+
requirement: *id004
|
|
76
|
+
- !ruby/object:Gem::Dependency
|
|
77
|
+
prerelease: false
|
|
78
|
+
name: mongo
|
|
79
|
+
type: :runtime
|
|
80
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
|
81
|
+
requirements:
|
|
82
|
+
- - ~>
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
segments:
|
|
85
|
+
- 1
|
|
86
|
+
- 0
|
|
87
|
+
- 5
|
|
88
|
+
version: 1.0.5
|
|
89
|
+
requirement: *id005
|
|
90
|
+
- !ruby/object:Gem::Dependency
|
|
91
|
+
prerelease: false
|
|
92
|
+
name: bson
|
|
93
|
+
type: :runtime
|
|
94
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
|
95
|
+
requirements:
|
|
96
|
+
- - ~>
|
|
97
|
+
- !ruby/object:Gem::Version
|
|
98
|
+
segments:
|
|
99
|
+
- 1
|
|
100
|
+
- 0
|
|
101
|
+
- 4
|
|
102
|
+
version: 1.0.4
|
|
103
|
+
requirement: *id006
|
|
104
|
+
- !ruby/object:Gem::Dependency
|
|
105
|
+
prerelease: false
|
|
106
|
+
name: bson_ext
|
|
107
|
+
type: :runtime
|
|
108
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
|
109
|
+
requirements:
|
|
110
|
+
- - ~>
|
|
111
|
+
- !ruby/object:Gem::Version
|
|
112
|
+
segments:
|
|
113
|
+
- 1
|
|
114
|
+
- 0
|
|
115
|
+
- 4
|
|
116
|
+
version: 1.0.4
|
|
117
|
+
requirement: *id007
|
|
118
|
+
description: Mongoid is an ODM (Object Document Mapper) Framework for MongoDB, written in Ruby.
|
|
119
|
+
email:
|
|
120
|
+
- durran@gmail.com
|
|
121
|
+
executables: []
|
|
122
|
+
|
|
123
|
+
extensions: []
|
|
124
|
+
|
|
125
|
+
extra_rdoc_files:
|
|
126
|
+
- README.rdoc
|
|
127
|
+
files:
|
|
128
|
+
- MIT_LICENSE
|
|
129
|
+
- README.rdoc
|
|
130
|
+
- lib/mongoid.rb
|
|
131
|
+
- lib/mongoid/associations.rb
|
|
132
|
+
- lib/mongoid/associations/embedded_in.rb
|
|
133
|
+
- lib/mongoid/associations/embeds_many.rb
|
|
134
|
+
- lib/mongoid/associations/embeds_one.rb
|
|
135
|
+
- lib/mongoid/associations/foreign_key.rb
|
|
136
|
+
- lib/mongoid/associations/meta_data.rb
|
|
137
|
+
- lib/mongoid/associations/options.rb
|
|
138
|
+
- lib/mongoid/associations/proxy.rb
|
|
139
|
+
- lib/mongoid/associations/referenced_in.rb
|
|
140
|
+
- lib/mongoid/associations/references_many.rb
|
|
141
|
+
- lib/mongoid/associations/references_many_as_array.rb
|
|
142
|
+
- lib/mongoid/associations/references_one.rb
|
|
143
|
+
- lib/mongoid/atomicity.rb
|
|
144
|
+
- lib/mongoid/attributes.rb
|
|
145
|
+
- lib/mongoid/callbacks.rb
|
|
146
|
+
- lib/mongoid/collection.rb
|
|
147
|
+
- lib/mongoid/collections.rb
|
|
148
|
+
- lib/mongoid/collections/cyclic_iterator.rb
|
|
149
|
+
- lib/mongoid/collections/master.rb
|
|
150
|
+
- lib/mongoid/collections/operations.rb
|
|
151
|
+
- lib/mongoid/collections/slaves.rb
|
|
152
|
+
- lib/mongoid/components.rb
|
|
153
|
+
- lib/mongoid/config.rb
|
|
154
|
+
- lib/mongoid/contexts.rb
|
|
155
|
+
- lib/mongoid/contexts/enumerable.rb
|
|
156
|
+
- lib/mongoid/contexts/ids.rb
|
|
157
|
+
- lib/mongoid/contexts/mongo.rb
|
|
158
|
+
- lib/mongoid/contexts/paging.rb
|
|
159
|
+
- lib/mongoid/criteria.rb
|
|
160
|
+
- lib/mongoid/criterion/complex.rb
|
|
161
|
+
- lib/mongoid/criterion/exclusion.rb
|
|
162
|
+
- lib/mongoid/criterion/inclusion.rb
|
|
163
|
+
- lib/mongoid/criterion/optional.rb
|
|
164
|
+
- lib/mongoid/cursor.rb
|
|
165
|
+
- lib/mongoid/deprecation.rb
|
|
166
|
+
- lib/mongoid/dirty.rb
|
|
167
|
+
- lib/mongoid/document.rb
|
|
168
|
+
- lib/mongoid/errors.rb
|
|
169
|
+
- lib/mongoid/extensions.rb
|
|
170
|
+
- lib/mongoid/extensions/array/accessors.rb
|
|
171
|
+
- lib/mongoid/extensions/array/assimilation.rb
|
|
172
|
+
- lib/mongoid/extensions/array/conversions.rb
|
|
173
|
+
- lib/mongoid/extensions/array/parentization.rb
|
|
174
|
+
- lib/mongoid/extensions/big_decimal/conversions.rb
|
|
175
|
+
- lib/mongoid/extensions/binary/conversions.rb
|
|
176
|
+
- lib/mongoid/extensions/boolean/conversions.rb
|
|
177
|
+
- lib/mongoid/extensions/date/conversions.rb
|
|
178
|
+
- lib/mongoid/extensions/datetime/conversions.rb
|
|
179
|
+
- lib/mongoid/extensions/false_class/equality.rb
|
|
180
|
+
- lib/mongoid/extensions/float/conversions.rb
|
|
181
|
+
- lib/mongoid/extensions/hash/accessors.rb
|
|
182
|
+
- lib/mongoid/extensions/hash/assimilation.rb
|
|
183
|
+
- lib/mongoid/extensions/hash/conversions.rb
|
|
184
|
+
- lib/mongoid/extensions/hash/criteria_helpers.rb
|
|
185
|
+
- lib/mongoid/extensions/hash/scoping.rb
|
|
186
|
+
- lib/mongoid/extensions/integer/conversions.rb
|
|
187
|
+
- lib/mongoid/extensions/nil/assimilation.rb
|
|
188
|
+
- lib/mongoid/extensions/object/conversions.rb
|
|
189
|
+
- lib/mongoid/extensions/objectid/conversions.rb
|
|
190
|
+
- lib/mongoid/extensions/proc/scoping.rb
|
|
191
|
+
- lib/mongoid/extensions/set/conversions.rb
|
|
192
|
+
- lib/mongoid/extensions/string/conversions.rb
|
|
193
|
+
- lib/mongoid/extensions/string/inflections.rb
|
|
194
|
+
- lib/mongoid/extensions/symbol/inflections.rb
|
|
195
|
+
- lib/mongoid/extensions/time_conversions.rb
|
|
196
|
+
- lib/mongoid/extensions/true_class/equality.rb
|
|
197
|
+
- lib/mongoid/extras.rb
|
|
198
|
+
- lib/mongoid/factory.rb
|
|
199
|
+
- lib/mongoid/field.rb
|
|
200
|
+
- lib/mongoid/fields.rb
|
|
201
|
+
- lib/mongoid/finders.rb
|
|
202
|
+
- lib/mongoid/hierarchy.rb
|
|
203
|
+
- lib/mongoid/identity.rb
|
|
204
|
+
- lib/mongoid/indexes.rb
|
|
205
|
+
- lib/mongoid/javascript.rb
|
|
206
|
+
- lib/mongoid/javascript/functions.yml
|
|
207
|
+
- lib/mongoid/logger.rb
|
|
208
|
+
- lib/mongoid/matchers.rb
|
|
209
|
+
- lib/mongoid/matchers/all.rb
|
|
210
|
+
- lib/mongoid/matchers/default.rb
|
|
211
|
+
- lib/mongoid/matchers/exists.rb
|
|
212
|
+
- lib/mongoid/matchers/gt.rb
|
|
213
|
+
- lib/mongoid/matchers/gte.rb
|
|
214
|
+
- lib/mongoid/matchers/in.rb
|
|
215
|
+
- lib/mongoid/matchers/lt.rb
|
|
216
|
+
- lib/mongoid/matchers/lte.rb
|
|
217
|
+
- lib/mongoid/matchers/ne.rb
|
|
218
|
+
- lib/mongoid/matchers/nin.rb
|
|
219
|
+
- lib/mongoid/matchers/size.rb
|
|
220
|
+
- lib/mongoid/memoization.rb
|
|
221
|
+
- lib/mongoid/named_scope.rb
|
|
222
|
+
- lib/mongoid/paranoia.rb
|
|
223
|
+
- lib/mongoid/paths.rb
|
|
224
|
+
- lib/mongoid/persistence.rb
|
|
225
|
+
- lib/mongoid/persistence/command.rb
|
|
226
|
+
- lib/mongoid/persistence/insert.rb
|
|
227
|
+
- lib/mongoid/persistence/insert_embedded.rb
|
|
228
|
+
- lib/mongoid/persistence/remove.rb
|
|
229
|
+
- lib/mongoid/persistence/remove_all.rb
|
|
230
|
+
- lib/mongoid/persistence/remove_embedded.rb
|
|
231
|
+
- lib/mongoid/persistence/update.rb
|
|
232
|
+
- lib/mongoid/railtie.rb
|
|
233
|
+
- lib/mongoid/railties/database.rake
|
|
234
|
+
- lib/mongoid/scope.rb
|
|
235
|
+
- lib/mongoid/state.rb
|
|
236
|
+
- lib/mongoid/timestamps.rb
|
|
237
|
+
- lib/mongoid/validations.rb
|
|
238
|
+
- lib/mongoid/validations/associated.rb
|
|
239
|
+
- lib/mongoid/validations/locale/en.yml
|
|
240
|
+
- lib/mongoid/validations/uniqueness.rb
|
|
241
|
+
- lib/mongoid/version.rb
|
|
242
|
+
- lib/mongoid/versioning.rb
|
|
243
|
+
- lib/rails/generators/mongoid/config/config_generator.rb
|
|
244
|
+
- lib/rails/generators/mongoid/config/templates/mongoid.yml
|
|
245
|
+
- lib/rails/generators/mongoid/model/model_generator.rb
|
|
246
|
+
- lib/rails/generators/mongoid/model/templates/model.rb
|
|
247
|
+
- lib/rails/generators/mongoid_generator.rb
|
|
248
|
+
has_rdoc: true
|
|
249
|
+
homepage: http://mongoid.org
|
|
250
|
+
licenses: []
|
|
251
|
+
|
|
252
|
+
post_install_message:
|
|
253
|
+
rdoc_options:
|
|
254
|
+
- --charset=UTF-8
|
|
255
|
+
require_paths:
|
|
256
|
+
- lib
|
|
257
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
258
|
+
requirements:
|
|
259
|
+
- - ">="
|
|
260
|
+
- !ruby/object:Gem::Version
|
|
261
|
+
segments:
|
|
262
|
+
- 0
|
|
263
|
+
version: "0"
|
|
264
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
|
+
requirements:
|
|
266
|
+
- - ">"
|
|
267
|
+
- !ruby/object:Gem::Version
|
|
268
|
+
segments:
|
|
269
|
+
- 1
|
|
270
|
+
- 3
|
|
271
|
+
- 1
|
|
272
|
+
version: 1.3.1
|
|
273
|
+
requirements: []
|
|
274
|
+
|
|
275
|
+
rubyforge_project:
|
|
276
|
+
rubygems_version: 1.3.6
|
|
277
|
+
signing_key:
|
|
278
|
+
specification_version: 3
|
|
279
|
+
summary: Elegent Persistance in Ruby for MongoDB (packaged for LocomotiveCMS).
|
|
280
|
+
test_files:
|
|
281
|
+
- spec/integration/mongoid/association_attributes_spec.rb
|
|
282
|
+
- spec/integration/mongoid/associations_spec.rb
|
|
283
|
+
- spec/integration/mongoid/attributes_spec.rb
|
|
284
|
+
- spec/integration/mongoid/callback_spec.rb
|
|
285
|
+
- spec/integration/mongoid/contexts/enumerable_spec.rb
|
|
286
|
+
- spec/integration/mongoid/criteria_spec.rb
|
|
287
|
+
- spec/integration/mongoid/dirty_spec.rb
|
|
288
|
+
- spec/integration/mongoid/document_spec.rb
|
|
289
|
+
- spec/integration/mongoid/extensions_spec.rb
|
|
290
|
+
- spec/integration/mongoid/finders_spec.rb
|
|
291
|
+
- spec/integration/mongoid/inheritance_spec.rb
|
|
292
|
+
- spec/integration/mongoid/named_scope_spec.rb
|
|
293
|
+
- spec/integration/mongoid/paranoia_spec.rb
|
|
294
|
+
- spec/integration/mongoid/persistence/update_spec.rb
|
|
295
|
+
- spec/integration/mongoid/persistence_spec.rb
|
|
296
|
+
- spec/integration/mongoid/validations/uniqueness_spec.rb
|
|
297
|
+
- spec/models/account.rb
|
|
298
|
+
- spec/models/address.rb
|
|
299
|
+
- spec/models/agent.rb
|
|
300
|
+
- spec/models/animal.rb
|
|
301
|
+
- spec/models/answer.rb
|
|
302
|
+
- spec/models/callbacks.rb
|
|
303
|
+
- spec/models/category.rb
|
|
304
|
+
- spec/models/comment.rb
|
|
305
|
+
- spec/models/country_code.rb
|
|
306
|
+
- spec/models/employer.rb
|
|
307
|
+
- spec/models/favorite.rb
|
|
308
|
+
- spec/models/game.rb
|
|
309
|
+
- spec/models/inheritance.rb
|
|
310
|
+
- spec/models/location.rb
|
|
311
|
+
- spec/models/login.rb
|
|
312
|
+
- spec/models/mixed_drink.rb
|
|
313
|
+
- spec/models/name.rb
|
|
314
|
+
- spec/models/namespacing.rb
|
|
315
|
+
- spec/models/paranoid_post.rb
|
|
316
|
+
- spec/models/parents.rb
|
|
317
|
+
- spec/models/patient.rb
|
|
318
|
+
- spec/models/person.rb
|
|
319
|
+
- spec/models/pet.rb
|
|
320
|
+
- spec/models/pet_owner.rb
|
|
321
|
+
- spec/models/phone.rb
|
|
322
|
+
- spec/models/post.rb
|
|
323
|
+
- spec/models/preference.rb
|
|
324
|
+
- spec/models/question.rb
|
|
325
|
+
- spec/models/survey.rb
|
|
326
|
+
- spec/models/translation.rb
|
|
327
|
+
- spec/models/user.rb
|
|
328
|
+
- spec/models/user_accout.rb
|
|
329
|
+
- spec/models/vet_visit.rb
|
|
330
|
+
- spec/models/video.rb
|
|
331
|
+
- spec/spec_helper.rb
|
|
332
|
+
- spec/unit/mongoid/associations/embedded_in_spec.rb
|
|
333
|
+
- spec/unit/mongoid/associations/embeds_many_spec.rb
|
|
334
|
+
- spec/unit/mongoid/associations/embeds_one_spec.rb
|
|
335
|
+
- spec/unit/mongoid/associations/foreign_key_spec.rb
|
|
336
|
+
- spec/unit/mongoid/associations/meta_data_spec.rb
|
|
337
|
+
- spec/unit/mongoid/associations/options_spec.rb
|
|
338
|
+
- spec/unit/mongoid/associations/referenced_in_spec.rb
|
|
339
|
+
- spec/unit/mongoid/associations/references_many_as_array_spec.rb
|
|
340
|
+
- spec/unit/mongoid/associations/references_many_spec.rb
|
|
341
|
+
- spec/unit/mongoid/associations/references_one_spec.rb
|
|
342
|
+
- spec/unit/mongoid/associations_spec.rb
|
|
343
|
+
- spec/unit/mongoid/atomicity_spec.rb
|
|
344
|
+
- spec/unit/mongoid/attributes_spec.rb
|
|
345
|
+
- spec/unit/mongoid/callbacks_spec.rb
|
|
346
|
+
- spec/unit/mongoid/collection_spec.rb
|
|
347
|
+
- spec/unit/mongoid/collections/cyclic_iterator_spec.rb
|
|
348
|
+
- spec/unit/mongoid/collections/master_spec.rb
|
|
349
|
+
- spec/unit/mongoid/collections/slaves_spec.rb
|
|
350
|
+
- spec/unit/mongoid/collections_spec.rb
|
|
351
|
+
- spec/unit/mongoid/config_spec.rb
|
|
352
|
+
- spec/unit/mongoid/contexts/enumerable_spec.rb
|
|
353
|
+
- spec/unit/mongoid/contexts/mongo_spec.rb
|
|
354
|
+
- spec/unit/mongoid/contexts_spec.rb
|
|
355
|
+
- spec/unit/mongoid/criteria_spec.rb
|
|
356
|
+
- spec/unit/mongoid/criterion/complex_spec.rb
|
|
357
|
+
- spec/unit/mongoid/criterion/exclusion_spec.rb
|
|
358
|
+
- spec/unit/mongoid/criterion/inclusion_spec.rb
|
|
359
|
+
- spec/unit/mongoid/criterion/optional_spec.rb
|
|
360
|
+
- spec/unit/mongoid/cursor_spec.rb
|
|
361
|
+
- spec/unit/mongoid/deprecation_spec.rb
|
|
362
|
+
- spec/unit/mongoid/dirty_spec.rb
|
|
363
|
+
- spec/unit/mongoid/document_spec.rb
|
|
364
|
+
- spec/unit/mongoid/errors_spec.rb
|
|
365
|
+
- spec/unit/mongoid/extensions/array/accessors_spec.rb
|
|
366
|
+
- spec/unit/mongoid/extensions/array/assimilation_spec.rb
|
|
367
|
+
- spec/unit/mongoid/extensions/array/conversions_spec.rb
|
|
368
|
+
- spec/unit/mongoid/extensions/array/parentization_spec.rb
|
|
369
|
+
- spec/unit/mongoid/extensions/big_decimal/conversions_spec.rb
|
|
370
|
+
- spec/unit/mongoid/extensions/binary/conversions_spec.rb
|
|
371
|
+
- spec/unit/mongoid/extensions/boolean/conversions_spec.rb
|
|
372
|
+
- spec/unit/mongoid/extensions/date/conversions_spec.rb
|
|
373
|
+
- spec/unit/mongoid/extensions/datetime/conversions_spec.rb
|
|
374
|
+
- spec/unit/mongoid/extensions/false_class/equality_spec.rb
|
|
375
|
+
- spec/unit/mongoid/extensions/float/conversions_spec.rb
|
|
376
|
+
- spec/unit/mongoid/extensions/hash/accessors_spec.rb
|
|
377
|
+
- spec/unit/mongoid/extensions/hash/assimilation_spec.rb
|
|
378
|
+
- spec/unit/mongoid/extensions/hash/conversions_spec.rb
|
|
379
|
+
- spec/unit/mongoid/extensions/hash/criteria_helpers_spec.rb
|
|
380
|
+
- spec/unit/mongoid/extensions/hash/scoping_spec.rb
|
|
381
|
+
- spec/unit/mongoid/extensions/integer/conversions_spec.rb
|
|
382
|
+
- spec/unit/mongoid/extensions/nil/assimilation_spec.rb
|
|
383
|
+
- spec/unit/mongoid/extensions/object/conversions_spec.rb
|
|
384
|
+
- spec/unit/mongoid/extensions/objectid/conversions_spec.rb
|
|
385
|
+
- spec/unit/mongoid/extensions/proc/scoping_spec.rb
|
|
386
|
+
- spec/unit/mongoid/extensions/set/conversions_spec.rb
|
|
387
|
+
- spec/unit/mongoid/extensions/string/conversions_spec.rb
|
|
388
|
+
- spec/unit/mongoid/extensions/string/inflections_spec.rb
|
|
389
|
+
- spec/unit/mongoid/extensions/symbol/inflections_spec.rb
|
|
390
|
+
- spec/unit/mongoid/extensions/time_conversions_spec.rb
|
|
391
|
+
- spec/unit/mongoid/extensions/true_class/equality_spec.rb
|
|
392
|
+
- spec/unit/mongoid/extras_spec.rb
|
|
393
|
+
- spec/unit/mongoid/factory_spec.rb
|
|
394
|
+
- spec/unit/mongoid/field_spec.rb
|
|
395
|
+
- spec/unit/mongoid/fields_spec.rb
|
|
396
|
+
- spec/unit/mongoid/finders_spec.rb
|
|
397
|
+
- spec/unit/mongoid/hierarchy_spec.rb
|
|
398
|
+
- spec/unit/mongoid/identity_spec.rb
|
|
399
|
+
- spec/unit/mongoid/indexes_spec.rb
|
|
400
|
+
- spec/unit/mongoid/javascript_spec.rb
|
|
401
|
+
- spec/unit/mongoid/logger_spec.rb
|
|
402
|
+
- spec/unit/mongoid/matchers/all_spec.rb
|
|
403
|
+
- spec/unit/mongoid/matchers/default_spec.rb
|
|
404
|
+
- spec/unit/mongoid/matchers/exists_spec.rb
|
|
405
|
+
- spec/unit/mongoid/matchers/gt_spec.rb
|
|
406
|
+
- spec/unit/mongoid/matchers/gte_spec.rb
|
|
407
|
+
- spec/unit/mongoid/matchers/in_spec.rb
|
|
408
|
+
- spec/unit/mongoid/matchers/lt_spec.rb
|
|
409
|
+
- spec/unit/mongoid/matchers/lte_spec.rb
|
|
410
|
+
- spec/unit/mongoid/matchers/ne_spec.rb
|
|
411
|
+
- spec/unit/mongoid/matchers/nin_spec.rb
|
|
412
|
+
- spec/unit/mongoid/matchers/size_spec.rb
|
|
413
|
+
- spec/unit/mongoid/matchers_spec.rb
|
|
414
|
+
- spec/unit/mongoid/memoization_spec.rb
|
|
415
|
+
- spec/unit/mongoid/named_scope_spec.rb
|
|
416
|
+
- spec/unit/mongoid/paranoia_spec.rb
|
|
417
|
+
- spec/unit/mongoid/paths_spec.rb
|
|
418
|
+
- spec/unit/mongoid/persistence/insert_embedded_spec.rb
|
|
419
|
+
- spec/unit/mongoid/persistence/insert_spec.rb
|
|
420
|
+
- spec/unit/mongoid/persistence/remove_all_spec.rb
|
|
421
|
+
- spec/unit/mongoid/persistence/remove_embedded_spec.rb
|
|
422
|
+
- spec/unit/mongoid/persistence/remove_spec.rb
|
|
423
|
+
- spec/unit/mongoid/persistence/update_spec.rb
|
|
424
|
+
- spec/unit/mongoid/persistence_spec.rb
|
|
425
|
+
- spec/unit/mongoid/scope_spec.rb
|
|
426
|
+
- spec/unit/mongoid/serialization_spec.rb
|
|
427
|
+
- spec/unit/mongoid/state_spec.rb
|
|
428
|
+
- spec/unit/mongoid/timestamps_spec.rb
|
|
429
|
+
- spec/unit/mongoid/validations/associated_spec.rb
|
|
430
|
+
- spec/unit/mongoid/validations/uniqueness_spec.rb
|
|
431
|
+
- spec/unit/mongoid/validations_spec.rb
|
|
432
|
+
- spec/unit/mongoid/versioning_spec.rb
|
|
433
|
+
- spec/unit/mongoid_spec.rb
|