File tree Expand file tree Collapse file tree 4 files changed +0
-82
lines changed Expand file tree Collapse file tree 4 files changed +0
-82
lines changed Original file line number Diff line number Diff line change @@ -63,16 +63,6 @@ def collectionize
63
63
tableize . gsub ( "/" , "_" )
64
64
end
65
65
66
- # Is the string a valid value for a Mongoid id?
67
- #
68
- # @example Is the string an id value?
69
- # "_id".mongoid_id?
70
- #
71
- # @return [ true | false ] If the string is id or _id.
72
- def mongoid_id?
73
- self =~ /\A (|_)id\z /
74
- end
75
-
76
66
# Is the string a number? The literals "NaN", "Infinity", and "-Infinity"
77
67
# are counted as numbers.
78
68
#
Original file line number Diff line number Diff line change @@ -7,16 +7,6 @@ module Extensions
7
7
# Adds type-casting behavior to Symbol class.
8
8
module Symbol
9
9
10
- # Is the symbol a valid value for a Mongoid id?
11
- #
12
- # @example Is the string an id value?
13
- # :_id.mongoid_id?
14
- #
15
- # @return [ true | false ] If the symbol is :id or :_id.
16
- def mongoid_id?
17
- to_s . mongoid_id?
18
- end
19
-
20
10
module ClassMethods
21
11
22
12
# Turn the object from the ruby type we deal with to a Mongo friendly
Original file line number Diff line number Diff line change @@ -172,37 +172,6 @@ class Patient
172
172
end
173
173
end
174
174
175
- describe "#mongoid_id?" do
176
-
177
- context "when the string is id" do
178
-
179
- it "returns true" do
180
- expect ( "id" ) . to be_mongoid_id
181
- end
182
- end
183
-
184
- context "when the string is _id" do
185
-
186
- it "returns true" do
187
- expect ( "_id" ) . to be_mongoid_id
188
- end
189
- end
190
-
191
- context "when the string contains id" do
192
-
193
- it "returns false" do
194
- expect ( "identity" ) . to_not be_mongoid_id
195
- end
196
- end
197
-
198
- context "when the string contains _id" do
199
-
200
- it "returns false" do
201
- expect ( "something_id" ) . to_not be_mongoid_id
202
- end
203
- end
204
- end
205
-
206
175
[ :mongoize , :demongoize ] . each do |method |
207
176
208
177
describe ".#{ method } " do
Original file line number Diff line number Diff line change 5
5
6
6
describe Mongoid ::Extensions ::Symbol do
7
7
8
- describe "#mongoid_id?" do
9
-
10
- context "when the string is id" do
11
-
12
- it "returns true" do
13
- expect ( :id ) . to be_mongoid_id
14
- end
15
- end
16
-
17
- context "when the string is _id" do
18
-
19
- it "returns true" do
20
- expect ( :_id ) . to be_mongoid_id
21
- end
22
- end
23
-
24
- context "when the string contains id" do
25
-
26
- it "returns false" do
27
- expect ( :identity ) . to_not be_mongoid_id
28
- end
29
- end
30
-
31
- context "when the string contains _id" do
32
-
33
- it "returns false" do
34
- expect ( :something_id ) . to_not be_mongoid_id
35
- end
36
- end
37
- end
38
-
39
8
[ :mongoize , :demongoize ] . each do |method |
40
9
41
10
describe ".mongoize" do
You can’t perform that action at this time.
0 commit comments