mongoid_paranoia 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,247 +1,247 @@
1
- class NormBase
2
- include Mongoid::Document
3
-
4
- has_one :norm_has_one, dependent: :destroy
5
- has_one :para_has_one, dependent: :destroy
6
-
7
- has_many :norm_has_many, dependent: :destroy
8
- has_many :para_has_many, dependent: :destroy
9
-
10
- has_many :norm_has_many_poly, dependent: :destroy
11
- has_many :para_has_many_poly, dependent: :destroy
12
-
13
- belongs_to :norm_belongs_to_one, dependent: :destroy
14
- belongs_to :para_belongs_to_one, dependent: :destroy
15
-
16
- belongs_to :norm_belongs_to, dependent: :destroy
17
- belongs_to :para_belongs_to, dependent: :destroy
18
-
19
- has_and_belongs_to_many :norm_habtm, dependent: :destroy
20
- has_and_belongs_to_many :para_habtm, dependent: :destroy
21
-
22
- embeds_one :norm_embeds_one
23
- embeds_one :para_embeds_one
24
-
25
- embeds_many :norm_embeds_many
26
- embeds_many :para_embeds_many
27
-
28
- embeds_many :norm_embeds_many_poly
29
- embeds_many :para_embeds_many_poly
30
- end
31
-
32
- class ParaBase
33
- include Mongoid::Document
34
- include Mongoid::Paranoia
35
-
36
- has_one :norm_has_one, dependent: :destroy
37
- has_one :para_has_one, dependent: :destroy
38
-
39
- has_many :norm_has_many, dependent: :destroy
40
- has_many :para_has_many, dependent: :destroy
41
-
42
- has_many :norm_has_many_poly, dependent: :destroy
43
- has_many :para_has_many_poly, dependent: :destroy
44
-
45
- belongs_to :norm_belongs_to_one, dependent: :destroy
46
- belongs_to :para_belongs_to_one, dependent: :destroy
47
-
48
- belongs_to :norm_belongs_to, dependent: :destroy
49
- belongs_to :para_belongs_to, dependent: :destroy
50
-
51
- has_and_belongs_to_many :norm_habtm, dependent: :destroy
52
- has_and_belongs_to_many :para_habtm, dependent: :destroy
53
-
54
- embeds_one :norm_embeds_one
55
- embeds_one :para_embeds_one
56
-
57
- embeds_many :norm_embeds_many
58
- embeds_many :para_embeds_many
59
-
60
- embeds_many :norm_embeds_many_poly
61
- embeds_many :para_embeds_many_poly
62
- end
63
-
64
- class NormHasOne
65
- include Mongoid::Document
66
-
67
- belongs_to :norm_base
68
- belongs_to :para_base
69
-
70
- has_one :norm_belongs_to, dependent: :destroy
71
- has_one :para_belongs_to, dependent: :destroy
72
-
73
- has_one :norm_habtm, dependent: :destroy
74
- has_one :norm_habtm, dependent: :destroy
75
- end
76
-
77
- class NormHasMany
78
- include Mongoid::Document
79
-
80
- belongs_to :norm_base
81
- belongs_to :para_base
82
-
83
- has_many :norm_belongs_to, dependent: :destroy
84
- has_many :para_belongs_to, dependent: :destroy
85
-
86
- has_many :norm_habtm, dependent: :destroy
87
- has_many :norm_habtm, dependent: :destroy
88
- end
89
-
90
- class NormHasManyPoly
91
- include Mongoid::Document
92
-
93
- belongs_to :base, polymorphic: true
94
- end
95
-
96
- class NormBelongsToOne
97
- include Mongoid::Document
98
-
99
- has_one :norm_base
100
- has_one :para_base
101
- end
102
-
103
- class NormBelongsTo
104
- include Mongoid::Document
105
-
106
- has_many :norm_base
107
- has_many :para_base
108
-
109
- belongs_to :norm_has_one, dependent: :destroy
110
- belongs_to :para_has_one, dependent: :destroy
111
-
112
- belongs_to :norm_has_many, dependent: :destroy
113
- belongs_to :para_has_many, dependent: :destroy
114
- end
115
-
116
- class NormHabtm
117
- include Mongoid::Document
118
-
119
- has_and_belongs_to_many :norm_base
120
- has_and_belongs_to_many :para_base
121
-
122
- belongs_to :norm_has_one, dependent: :destroy
123
- belongs_to :para_has_one, dependent: :destroy
124
-
125
- belongs_to :norm_has_many, dependent: :destroy
126
- belongs_to :para_has_many, dependent: :destroy
127
-
128
- has_and_belongs_to_many :recursive, class_name: 'NormHabtm', inverse_of: :recursive, dependent: :destroy
129
- has_and_belongs_to_many :para_habtm, dependent: :destroy
130
- end
131
-
132
- class NormEmbedsOne
133
- include Mongoid::Document
134
-
135
- embedded_in :norm_base
136
- embedded_in :para_base
137
- end
138
-
139
- class NormEmbedsMany
140
- include Mongoid::Document
141
-
142
- embedded_in :norm_base
143
- embedded_in :para_base
144
- end
145
-
146
- class NormEmbedsManyPoly
147
- include Mongoid::Document
148
-
149
- embedded_in :base, polymorphic: true
150
- end
151
-
152
- class ParaHasOne
153
- include Mongoid::Document
154
- include Mongoid::Paranoia
155
-
156
- belongs_to :norm_base
157
- belongs_to :para_base
158
-
159
- has_one :norm_belongs_to, dependent: :destroy
160
- has_one :para_belongs_to, dependent: :destroy
161
-
162
- has_one :norm_habtm, dependent: :destroy
163
- has_one :norm_habtm, dependent: :destroy
164
- end
165
-
166
- class ParaHasMany
167
- include Mongoid::Document
168
- include Mongoid::Paranoia
169
-
170
- belongs_to :norm_base
171
- belongs_to :para_base
172
-
173
- has_many :norm_belongs_to, dependent: :destroy
174
- has_many :para_belongs_to, dependent: :destroy
175
-
176
- has_many :norm_habtm, dependent: :destroy
177
- has_many :norm_habtm, dependent: :destroy
178
- end
179
-
180
- class ParaHasManyPoly
181
- include Mongoid::Document
182
- include Mongoid::Paranoia
183
-
184
- belongs_to :base, polymorphic: true
185
- end
186
-
187
- class ParaBelongsToOne
188
- include Mongoid::Document
189
- include Mongoid::Paranoia
190
-
191
- has_one :norm_base
192
- has_one :para_base
193
- end
194
-
195
- class ParaBelongsTo
196
- include Mongoid::Document
197
- include Mongoid::Paranoia
198
-
199
- has_many :norm_base
200
- has_many :para_base
201
-
202
- belongs_to :norm_has_one, dependent: :destroy
203
- belongs_to :para_has_one, dependent: :destroy
204
-
205
- belongs_to :norm_has_many, dependent: :destroy
206
- belongs_to :para_has_many, dependent: :destroy
207
- end
208
-
209
- class ParaHabtm
210
- include Mongoid::Document
211
- include Mongoid::Paranoia
212
-
213
- has_and_belongs_to_many :norm_base
214
- has_and_belongs_to_many :para_base
215
-
216
- belongs_to :norm_has_one, dependent: :destroy
217
- belongs_to :para_has_one, dependent: :destroy
218
-
219
- belongs_to :norm_has_many, dependent: :destroy
220
- belongs_to :para_has_many, dependent: :destroy
221
-
222
- has_and_belongs_to_many :norm_habtm, dependent: :destroy
223
- has_and_belongs_to_many :recursive, class_name: 'ParaHabtm', inverse_of: :recursive, dependent: :destroy
224
- end
225
-
226
- class ParaEmbedsOne
227
- include Mongoid::Document
228
- include Mongoid::Paranoia
229
-
230
- embedded_in :norm_base
231
- embedded_in :para_base
232
- end
233
-
234
- class ParaEmbedsMany
235
- include Mongoid::Document
236
- include Mongoid::Paranoia
237
-
238
- embedded_in :norm_base
239
- embedded_in :para_base
240
- end
241
-
242
- class ParaEmbedsManyPoly
243
- include Mongoid::Document
244
- include Mongoid::Paranoia
245
-
246
- embedded_in :base, polymorphic: true
247
- end
1
+ class NormBase
2
+ include Mongoid::Document
3
+
4
+ has_one :norm_has_one, dependent: :destroy
5
+ has_one :para_has_one, dependent: :destroy
6
+
7
+ has_many :norm_has_many, dependent: :destroy
8
+ has_many :para_has_many, dependent: :destroy
9
+
10
+ has_many :norm_has_many_poly, dependent: :destroy
11
+ has_many :para_has_many_poly, dependent: :destroy
12
+
13
+ belongs_to :norm_belongs_to_one, dependent: :destroy
14
+ belongs_to :para_belongs_to_one, dependent: :destroy
15
+
16
+ belongs_to :norm_belongs_to, dependent: :destroy
17
+ belongs_to :para_belongs_to, dependent: :destroy
18
+
19
+ has_and_belongs_to_many :norm_habtm, dependent: :destroy
20
+ has_and_belongs_to_many :para_habtm, dependent: :destroy
21
+
22
+ embeds_one :norm_embeds_one
23
+ embeds_one :para_embeds_one
24
+
25
+ embeds_many :norm_embeds_many
26
+ embeds_many :para_embeds_many
27
+
28
+ embeds_many :norm_embeds_many_poly
29
+ embeds_many :para_embeds_many_poly
30
+ end
31
+
32
+ class ParaBase
33
+ include Mongoid::Document
34
+ include Mongoid::Paranoia
35
+
36
+ has_one :norm_has_one, dependent: :destroy
37
+ has_one :para_has_one, dependent: :destroy
38
+
39
+ has_many :norm_has_many, dependent: :destroy
40
+ has_many :para_has_many, dependent: :destroy
41
+
42
+ has_many :norm_has_many_poly, dependent: :destroy
43
+ has_many :para_has_many_poly, dependent: :destroy
44
+
45
+ belongs_to :norm_belongs_to_one, dependent: :destroy
46
+ belongs_to :para_belongs_to_one, dependent: :destroy
47
+
48
+ belongs_to :norm_belongs_to, dependent: :destroy
49
+ belongs_to :para_belongs_to, dependent: :destroy
50
+
51
+ has_and_belongs_to_many :norm_habtm, dependent: :destroy
52
+ has_and_belongs_to_many :para_habtm, dependent: :destroy
53
+
54
+ embeds_one :norm_embeds_one
55
+ embeds_one :para_embeds_one
56
+
57
+ embeds_many :norm_embeds_many
58
+ embeds_many :para_embeds_many
59
+
60
+ embeds_many :norm_embeds_many_poly
61
+ embeds_many :para_embeds_many_poly
62
+ end
63
+
64
+ class NormHasOne
65
+ include Mongoid::Document
66
+
67
+ belongs_to :norm_base
68
+ belongs_to :para_base
69
+
70
+ has_one :norm_belongs_to, dependent: :destroy
71
+ has_one :para_belongs_to, dependent: :destroy
72
+
73
+ has_one :norm_habtm, dependent: :destroy
74
+ has_one :norm_habtm, dependent: :destroy
75
+ end
76
+
77
+ class NormHasMany
78
+ include Mongoid::Document
79
+
80
+ belongs_to :norm_base
81
+ belongs_to :para_base
82
+
83
+ has_many :norm_belongs_to, dependent: :destroy
84
+ has_many :para_belongs_to, dependent: :destroy
85
+
86
+ has_many :norm_habtm, dependent: :destroy
87
+ has_many :norm_habtm, dependent: :destroy
88
+ end
89
+
90
+ class NormHasManyPoly
91
+ include Mongoid::Document
92
+
93
+ belongs_to :base, polymorphic: true
94
+ end
95
+
96
+ class NormBelongsToOne
97
+ include Mongoid::Document
98
+
99
+ has_one :norm_base
100
+ has_one :para_base
101
+ end
102
+
103
+ class NormBelongsTo
104
+ include Mongoid::Document
105
+
106
+ has_many :norm_base
107
+ has_many :para_base
108
+
109
+ belongs_to :norm_has_one, dependent: :destroy
110
+ belongs_to :para_has_one, dependent: :destroy
111
+
112
+ belongs_to :norm_has_many, dependent: :destroy
113
+ belongs_to :para_has_many, dependent: :destroy
114
+ end
115
+
116
+ class NormHabtm
117
+ include Mongoid::Document
118
+
119
+ has_and_belongs_to_many :norm_base
120
+ has_and_belongs_to_many :para_base
121
+
122
+ belongs_to :norm_has_one, dependent: :destroy
123
+ belongs_to :para_has_one, dependent: :destroy
124
+
125
+ belongs_to :norm_has_many, dependent: :destroy
126
+ belongs_to :para_has_many, dependent: :destroy
127
+
128
+ has_and_belongs_to_many :recursive, class_name: 'NormHabtm', inverse_of: :recursive, dependent: :destroy
129
+ has_and_belongs_to_many :para_habtm, dependent: :destroy
130
+ end
131
+
132
+ class NormEmbedsOne
133
+ include Mongoid::Document
134
+
135
+ embedded_in :norm_base
136
+ embedded_in :para_base
137
+ end
138
+
139
+ class NormEmbedsMany
140
+ include Mongoid::Document
141
+
142
+ embedded_in :norm_base
143
+ embedded_in :para_base
144
+ end
145
+
146
+ class NormEmbedsManyPoly
147
+ include Mongoid::Document
148
+
149
+ embedded_in :base, polymorphic: true
150
+ end
151
+
152
+ class ParaHasOne
153
+ include Mongoid::Document
154
+ include Mongoid::Paranoia
155
+
156
+ belongs_to :norm_base
157
+ belongs_to :para_base
158
+
159
+ has_one :norm_belongs_to, dependent: :destroy
160
+ has_one :para_belongs_to, dependent: :destroy
161
+
162
+ has_one :norm_habtm, dependent: :destroy
163
+ has_one :norm_habtm, dependent: :destroy
164
+ end
165
+
166
+ class ParaHasMany
167
+ include Mongoid::Document
168
+ include Mongoid::Paranoia
169
+
170
+ belongs_to :norm_base
171
+ belongs_to :para_base
172
+
173
+ has_many :norm_belongs_to, dependent: :destroy
174
+ has_many :para_belongs_to, dependent: :destroy
175
+
176
+ has_many :norm_habtm, dependent: :destroy
177
+ has_many :norm_habtm, dependent: :destroy
178
+ end
179
+
180
+ class ParaHasManyPoly
181
+ include Mongoid::Document
182
+ include Mongoid::Paranoia
183
+
184
+ belongs_to :base, polymorphic: true
185
+ end
186
+
187
+ class ParaBelongsToOne
188
+ include Mongoid::Document
189
+ include Mongoid::Paranoia
190
+
191
+ has_one :norm_base
192
+ has_one :para_base
193
+ end
194
+
195
+ class ParaBelongsTo
196
+ include Mongoid::Document
197
+ include Mongoid::Paranoia
198
+
199
+ has_many :norm_base
200
+ has_many :para_base
201
+
202
+ belongs_to :norm_has_one, dependent: :destroy
203
+ belongs_to :para_has_one, dependent: :destroy
204
+
205
+ belongs_to :norm_has_many, dependent: :destroy
206
+ belongs_to :para_has_many, dependent: :destroy
207
+ end
208
+
209
+ class ParaHabtm
210
+ include Mongoid::Document
211
+ include Mongoid::Paranoia
212
+
213
+ has_and_belongs_to_many :norm_base
214
+ has_and_belongs_to_many :para_base
215
+
216
+ belongs_to :norm_has_one, dependent: :destroy
217
+ belongs_to :para_has_one, dependent: :destroy
218
+
219
+ belongs_to :norm_has_many, dependent: :destroy
220
+ belongs_to :para_has_many, dependent: :destroy
221
+
222
+ has_and_belongs_to_many :norm_habtm, dependent: :destroy
223
+ has_and_belongs_to_many :recursive, class_name: 'ParaHabtm', inverse_of: :recursive, dependent: :destroy
224
+ end
225
+
226
+ class ParaEmbedsOne
227
+ include Mongoid::Document
228
+ include Mongoid::Paranoia
229
+
230
+ embedded_in :norm_base
231
+ embedded_in :para_base
232
+ end
233
+
234
+ class ParaEmbedsMany
235
+ include Mongoid::Document
236
+ include Mongoid::Paranoia
237
+
238
+ embedded_in :norm_base
239
+ embedded_in :para_base
240
+ end
241
+
242
+ class ParaEmbedsManyPoly
243
+ include Mongoid::Document
244
+ include Mongoid::Paranoia
245
+
246
+ embedded_in :base, polymorphic: true
247
+ end
@@ -1,6 +1,6 @@
1
- class Tag
2
- include Mongoid::Document
3
- field :text, type: String
4
- has_and_belongs_to_many :paranoid_posts
5
- has_and_belongs_to_many :related, class_name: "Tag", inverse_of: :related
6
- end
1
+ class Tag
2
+ include Mongoid::Document
3
+ field :text, type: String
4
+ has_and_belongs_to_many :paranoid_posts
5
+ has_and_belongs_to_many :related, class_name: "Tag", inverse_of: :related
6
+ end
@@ -1,4 +1,4 @@
1
- class Title
2
- include Mongoid::Document
3
- belongs_to :paranoid_post
4
- end
1
+ class Title
2
+ include Mongoid::Document
3
+ belongs_to :paranoid_post
4
+ end
@@ -1,19 +1,19 @@
1
- require "spec_helper"
2
-
3
- module Mongoid
4
- module Paranoia
5
- describe Configuration do
6
- describe '#paranoid_field' do
7
- it 'initializes with default value set to :deleted_at' do
8
- expect(Configuration.new.paranoid_field).to eq(:deleted_at)
9
- end
10
-
11
- it 'can be updated' do
12
- config = Configuration.new
13
- config.paranoid_field = :myFieldName
14
- expect(config.paranoid_field).to eq(:myFieldName)
15
- end
16
- end
17
- end
18
- end
19
- end
1
+ require "spec_helper"
2
+
3
+ module Mongoid
4
+ module Paranoia
5
+ describe Configuration do
6
+ describe '#paranoid_field' do
7
+ it 'initializes with default value set to :deleted_at' do
8
+ expect(Configuration.new.paranoid_field).to eq(:deleted_at)
9
+ end
10
+
11
+ it 'can be updated' do
12
+ config = Configuration.new
13
+ config.paranoid_field = :myFieldName
14
+ expect(config.paranoid_field).to eq(:myFieldName)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,21 +1,21 @@
1
- require "spec_helper"
2
-
3
- describe Mongoid::Document do
4
-
5
- describe ".paranoid?" do
6
-
7
- context "when Mongoid::Paranoia is included" do
8
- subject { ParanoidPost }
9
- it "returns true" do
10
- expect(subject.paranoid?).to be_truthy
11
- end
12
- end
13
-
14
- context "when Mongoid::Paranoia not included" do
15
- subject { Author }
16
- it "returns true" do
17
- expect(subject.paranoid?).to be_falsey
18
- end
19
- end
20
- end
21
- end
1
+ require "spec_helper"
2
+
3
+ describe Mongoid::Document do
4
+
5
+ describe ".paranoid?" do
6
+
7
+ context "when Mongoid::Paranoia is included" do
8
+ subject { ParanoidPost }
9
+ it "returns true" do
10
+ expect(subject.paranoid?).to be_truthy
11
+ end
12
+ end
13
+
14
+ context "when Mongoid::Paranoia not included" do
15
+ subject { Author }
16
+ it "returns true" do
17
+ expect(subject.paranoid?).to be_falsey
18
+ end
19
+ end
20
+ end
21
+ end