enju_subject 0.1.1 → 0.2.0.beta.1
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.
- checksums.yaml +4 -4
- data/README.rdoc +3 -3
- data/app/controllers/classification_types_controller.rb +13 -2
- data/app/controllers/classifications_controller.rb +12 -3
- data/app/controllers/concerns/enju_subject/controller.rb +27 -0
- data/app/controllers/subject_heading_types_controller.rb +13 -2
- data/app/controllers/subject_types_controller.rb +13 -2
- data/app/controllers/subjects_controller.rb +12 -4
- data/app/models/classification.rb +1 -1
- data/app/models/classification_type.rb +0 -1
- data/app/models/concerns/enju_subject/enju_manifestation.rb +37 -0
- data/app/models/subject.rb +1 -1
- data/app/models/subject_heading_type.rb +0 -1
- data/app/models/subject_type.rb +0 -1
- data/app/policies/classification_policy.rb +21 -0
- data/app/policies/classification_type_policy.rb +23 -0
- data/app/policies/subject_heading_type_policy.rb +23 -0
- data/app/policies/subject_policy.rb +21 -0
- data/app/policies/subject_type_policy.rb +21 -0
- data/app/views/classification_types/index.html.erb +4 -4
- data/app/views/classification_types/show.html.erb +2 -2
- data/app/views/classifications/index.html.erb +2 -2
- data/app/views/classifications/show.html.erb +2 -2
- data/app/views/manifestations/_classification_fields.html.erb +5 -0
- data/app/views/manifestations/_subject_facet.html.erb +2 -2
- data/app/views/manifestations/_subject_fields.html.erb +6 -0
- data/app/views/manifestations/_subject_form.html.erb +8 -9
- data/app/views/subject_heading_types/index.html.erb +4 -4
- data/app/views/subject_heading_types/show.html.erb +2 -2
- data/app/views/subject_types/index.html.erb +4 -4
- data/app/views/subject_types/show.html.erb +2 -2
- data/app/views/subjects/index.html.erb +3 -3
- data/app/views/subjects/index.rss.builder +2 -2
- data/app/views/subjects/show.html.erb +3 -3
- data/db/fixtures/subject_types.yml +4 -4
- data/lib/enju_subject/master_model.rb +3 -3
- data/lib/enju_subject/version.rb +1 -1
- data/lib/enju_subject.rb +0 -29
- data/lib/generators/enju_subject/setup/setup_generator.rb +6 -1
- data/lib/generators/enju_subject/setup/templates/db/fixtures/classification_types.yml +6 -0
- data/lib/generators/enju_subject/setup/templates/db/fixtures/subject_heading_types.yml +6 -6
- data/lib/tasks/enju_subject_tasks.rake +1 -1
- data/spec/controllers/classification_types_controller_spec.rb +13 -13
- data/spec/controllers/classifications_controller_spec.rb +9 -9
- data/spec/controllers/subject_heading_types_controller_spec.rb +58 -58
- data/spec/controllers/subject_types_controller_spec.rb +13 -13
- data/spec/controllers/subjects_controller_spec.rb +9 -9
- data/spec/dummy/app/controllers/application_controller.rb +8 -4
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/config/application.rb +5 -24
- data/spec/dummy/config/environments/development.rb +25 -14
- data/spec/dummy/config/environments/production.rb +50 -31
- data/spec/dummy/config/environments/test.rb +23 -18
- data/spec/dummy/config/initializers/enju_leaf.rb +1 -0
- data/spec/dummy/db/schema.rb +2 -1
- data/spec/lib/generators/enju_subject/setup/setup_generator_spec.rb +34 -0
- data/spec/support/devise.rb +2 -1
- metadata +95 -20
- data/app/models/enju_subject/ability.rb +0 -58
- data/lib/enju_subject/manifestation.rb +0 -44
- data/spec/dummy/app/models/ability.rb +0 -59
- data/spec/dummy/config/application.yml +0 -38
- data/spec/dummy/config/initializers/assets.rb +0 -12
@@ -19,7 +19,7 @@ describe SubjectHeadingTypesController do
|
|
19
19
|
|
20
20
|
it "assigns all subject_heading_types as @subject_heading_types" do
|
21
21
|
get :index
|
22
|
-
expect(assigns(:subject_heading_types)).to eq(SubjectHeadingType.
|
22
|
+
expect(assigns(:subject_heading_types)).to eq(SubjectHeadingType.order(:position))
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -28,7 +28,7 @@ describe SubjectHeadingTypesController do
|
|
28
28
|
|
29
29
|
it "assigns all subject_heading_types as @subject_heading_types" do
|
30
30
|
get :index
|
31
|
-
expect(assigns(:subject_heading_types)).to eq(SubjectHeadingType.
|
31
|
+
expect(assigns(:subject_heading_types)).to eq(SubjectHeadingType.order(:position))
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -37,14 +37,14 @@ describe SubjectHeadingTypesController do
|
|
37
37
|
|
38
38
|
it "assigns all subject_heading_types as @subject_heading_types" do
|
39
39
|
get :index
|
40
|
-
expect(assigns(:subject_heading_types)).to eq(SubjectHeadingType.
|
40
|
+
expect(assigns(:subject_heading_types)).to eq(SubjectHeadingType.order(:position))
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
describe "When not logged in" do
|
45
45
|
it "assigns all subject_heading_types as @subject_heading_types" do
|
46
46
|
get :index
|
47
|
-
expect(assigns(:subject_heading_types)).to eq(SubjectHeadingType.
|
47
|
+
expect(assigns(:subject_heading_types)).to eq(SubjectHeadingType.order(:position))
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -55,7 +55,7 @@ describe SubjectHeadingTypesController do
|
|
55
55
|
|
56
56
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
57
57
|
subject_heading_type = FactoryGirl.create(:subject_heading_type)
|
58
|
-
get :show, :
|
58
|
+
get :show, id: subject_heading_type.id
|
59
59
|
expect(assigns(:subject_heading_type)).to eq(subject_heading_type)
|
60
60
|
end
|
61
61
|
end
|
@@ -65,7 +65,7 @@ describe SubjectHeadingTypesController do
|
|
65
65
|
|
66
66
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
67
67
|
subject_heading_type = FactoryGirl.create(:subject_heading_type)
|
68
|
-
get :show, :
|
68
|
+
get :show, id: subject_heading_type.id
|
69
69
|
expect(assigns(:subject_heading_type)).to eq(subject_heading_type)
|
70
70
|
end
|
71
71
|
end
|
@@ -75,7 +75,7 @@ describe SubjectHeadingTypesController do
|
|
75
75
|
|
76
76
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
77
77
|
subject_heading_type = FactoryGirl.create(:subject_heading_type)
|
78
|
-
get :show, :
|
78
|
+
get :show, id: subject_heading_type.id
|
79
79
|
expect(assigns(:subject_heading_type)).to eq(subject_heading_type)
|
80
80
|
end
|
81
81
|
end
|
@@ -83,7 +83,7 @@ describe SubjectHeadingTypesController do
|
|
83
83
|
describe "When not logged in" do
|
84
84
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
85
85
|
subject_heading_type = FactoryGirl.create(:subject_heading_type)
|
86
|
-
get :show, :
|
86
|
+
get :show, id: subject_heading_type.id
|
87
87
|
expect(assigns(:subject_heading_type)).to eq(subject_heading_type)
|
88
88
|
end
|
89
89
|
end
|
@@ -105,7 +105,7 @@ describe SubjectHeadingTypesController do
|
|
105
105
|
|
106
106
|
it "should not assign the requested subject_heading_type as @subject_heading_type" do
|
107
107
|
get :new
|
108
|
-
expect(assigns(:subject_heading_type)).
|
108
|
+
expect(assigns(:subject_heading_type)).to be_nil
|
109
109
|
response.should be_forbidden
|
110
110
|
end
|
111
111
|
end
|
@@ -115,7 +115,7 @@ describe SubjectHeadingTypesController do
|
|
115
115
|
|
116
116
|
it "should not assign the requested subject_heading_type as @subject_heading_type" do
|
117
117
|
get :new
|
118
|
-
expect(assigns(:subject_heading_type)).
|
118
|
+
expect(assigns(:subject_heading_type)).to be_nil
|
119
119
|
response.should be_forbidden
|
120
120
|
end
|
121
121
|
end
|
@@ -123,7 +123,7 @@ describe SubjectHeadingTypesController do
|
|
123
123
|
describe "When not logged in" do
|
124
124
|
it "should not assign the requested subject_heading_type as @subject_heading_type" do
|
125
125
|
get :new
|
126
|
-
expect(assigns(:subject_heading_type)).
|
126
|
+
expect(assigns(:subject_heading_type)).to be_nil
|
127
127
|
response.should redirect_to(new_user_session_url)
|
128
128
|
end
|
129
129
|
end
|
@@ -135,7 +135,7 @@ describe SubjectHeadingTypesController do
|
|
135
135
|
|
136
136
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
137
137
|
subject_heading_type = FactoryGirl.create(:subject_heading_type)
|
138
|
-
get :edit, :
|
138
|
+
get :edit, id: subject_heading_type.id
|
139
139
|
expect(assigns(:subject_heading_type)).to eq(subject_heading_type)
|
140
140
|
end
|
141
141
|
end
|
@@ -145,7 +145,7 @@ describe SubjectHeadingTypesController do
|
|
145
145
|
|
146
146
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
147
147
|
subject_heading_type = FactoryGirl.create(:subject_heading_type)
|
148
|
-
get :edit, :
|
148
|
+
get :edit, id: subject_heading_type.id
|
149
149
|
response.should be_forbidden
|
150
150
|
end
|
151
151
|
end
|
@@ -155,7 +155,7 @@ describe SubjectHeadingTypesController do
|
|
155
155
|
|
156
156
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
157
157
|
subject_heading_type = FactoryGirl.create(:subject_heading_type)
|
158
|
-
get :edit, :
|
158
|
+
get :edit, id: subject_heading_type.id
|
159
159
|
response.should be_forbidden
|
160
160
|
end
|
161
161
|
end
|
@@ -163,7 +163,7 @@ describe SubjectHeadingTypesController do
|
|
163
163
|
describe "When not logged in" do
|
164
164
|
it "should not assign the requested subject_heading_type as @subject_heading_type" do
|
165
165
|
subject_heading_type = FactoryGirl.create(:subject_heading_type)
|
166
|
-
get :edit, :
|
166
|
+
get :edit, id: subject_heading_type.id
|
167
167
|
response.should redirect_to(new_user_session_url)
|
168
168
|
end
|
169
169
|
end
|
@@ -180,24 +180,24 @@ describe SubjectHeadingTypesController do
|
|
180
180
|
|
181
181
|
describe "with valid params" do
|
182
182
|
it "assigns a newly created subject_heading_type as @subject_heading_type" do
|
183
|
-
post :create, :
|
183
|
+
post :create, subject_heading_type: @attrs
|
184
184
|
expect(assigns(:subject_heading_type)).to be_valid
|
185
185
|
end
|
186
186
|
|
187
187
|
it "redirects to the created agent" do
|
188
|
-
post :create, :
|
188
|
+
post :create, subject_heading_type: @attrs
|
189
189
|
response.should redirect_to(assigns(:subject_heading_type))
|
190
190
|
end
|
191
191
|
end
|
192
192
|
|
193
193
|
describe "with invalid params" do
|
194
194
|
it "assigns a newly created but unsaved subject_heading_type as @subject_heading_type" do
|
195
|
-
post :create, :
|
195
|
+
post :create, subject_heading_type: @invalid_attrs
|
196
196
|
expect(assigns(:subject_heading_type)).not_to be_valid
|
197
197
|
end
|
198
198
|
|
199
199
|
it "should be successful" do
|
200
|
-
post :create, :
|
200
|
+
post :create, subject_heading_type: @invalid_attrs
|
201
201
|
response.should be_success
|
202
202
|
end
|
203
203
|
end
|
@@ -208,24 +208,24 @@ describe SubjectHeadingTypesController do
|
|
208
208
|
|
209
209
|
describe "with valid params" do
|
210
210
|
it "assigns a newly created subject_heading_type as @subject_heading_type" do
|
211
|
-
post :create, :
|
212
|
-
expect(assigns(:subject_heading_type)).to
|
211
|
+
post :create, subject_heading_type: @attrs
|
212
|
+
expect(assigns(:subject_heading_type)).to be_nil
|
213
213
|
end
|
214
214
|
|
215
215
|
it "should be forbidden" do
|
216
|
-
post :create, :
|
216
|
+
post :create, subject_heading_type: @attrs
|
217
217
|
response.should be_forbidden
|
218
218
|
end
|
219
219
|
end
|
220
220
|
|
221
221
|
describe "with invalid params" do
|
222
222
|
it "assigns a newly created but unsaved subject_heading_type as @subject_heading_type" do
|
223
|
-
post :create, :
|
224
|
-
expect(assigns(:subject_heading_type)).
|
223
|
+
post :create, subject_heading_type: @invalid_attrs
|
224
|
+
expect(assigns(:subject_heading_type)).to be_nil
|
225
225
|
end
|
226
226
|
|
227
227
|
it "should be forbidden" do
|
228
|
-
post :create, :
|
228
|
+
post :create, subject_heading_type: @invalid_attrs
|
229
229
|
response.should be_forbidden
|
230
230
|
end
|
231
231
|
end
|
@@ -236,24 +236,24 @@ describe SubjectHeadingTypesController do
|
|
236
236
|
|
237
237
|
describe "with valid params" do
|
238
238
|
it "assigns a newly created subject_heading_type as @subject_heading_type" do
|
239
|
-
post :create, :
|
240
|
-
expect(assigns(:subject_heading_type)).to
|
239
|
+
post :create, subject_heading_type: @attrs
|
240
|
+
expect(assigns(:subject_heading_type)).to be_nil
|
241
241
|
end
|
242
242
|
|
243
243
|
it "should be forbidden" do
|
244
|
-
post :create, :
|
244
|
+
post :create, subject_heading_type: @attrs
|
245
245
|
response.should be_forbidden
|
246
246
|
end
|
247
247
|
end
|
248
248
|
|
249
249
|
describe "with invalid params" do
|
250
250
|
it "assigns a newly created but unsaved subject_heading_type as @subject_heading_type" do
|
251
|
-
post :create, :
|
252
|
-
expect(assigns(:subject_heading_type)).
|
251
|
+
post :create, subject_heading_type: @invalid_attrs
|
252
|
+
expect(assigns(:subject_heading_type)).to be_nil
|
253
253
|
end
|
254
254
|
|
255
255
|
it "should be forbidden" do
|
256
|
-
post :create, :
|
256
|
+
post :create, subject_heading_type: @invalid_attrs
|
257
257
|
response.should be_forbidden
|
258
258
|
end
|
259
259
|
end
|
@@ -262,24 +262,24 @@ describe SubjectHeadingTypesController do
|
|
262
262
|
describe "When not logged in" do
|
263
263
|
describe "with valid params" do
|
264
264
|
it "assigns a newly created subject_heading_type as @subject_heading_type" do
|
265
|
-
post :create, :
|
266
|
-
expect(assigns(:subject_heading_type)).to
|
265
|
+
post :create, subject_heading_type: @attrs
|
266
|
+
expect(assigns(:subject_heading_type)).to be_nil
|
267
267
|
end
|
268
268
|
|
269
269
|
it "should be forbidden" do
|
270
|
-
post :create, :
|
270
|
+
post :create, subject_heading_type: @attrs
|
271
271
|
response.should redirect_to(new_user_session_url)
|
272
272
|
end
|
273
273
|
end
|
274
274
|
|
275
275
|
describe "with invalid params" do
|
276
276
|
it "assigns a newly created but unsaved subject_heading_type as @subject_heading_type" do
|
277
|
-
post :create, :
|
278
|
-
expect(assigns(:subject_heading_type)).
|
277
|
+
post :create, subject_heading_type: @invalid_attrs
|
278
|
+
expect(assigns(:subject_heading_type)).to be_nil
|
279
279
|
end
|
280
280
|
|
281
281
|
it "should be forbidden" do
|
282
|
-
post :create, :
|
282
|
+
post :create, subject_heading_type: @invalid_attrs
|
283
283
|
response.should redirect_to(new_user_session_url)
|
284
284
|
end
|
285
285
|
end
|
@@ -298,23 +298,23 @@ describe SubjectHeadingTypesController do
|
|
298
298
|
|
299
299
|
describe "with valid params" do
|
300
300
|
it "updates the requested subject_heading_type" do
|
301
|
-
put :update, :
|
301
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @attrs
|
302
302
|
end
|
303
303
|
|
304
304
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
305
|
-
put :update, :
|
305
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @attrs
|
306
306
|
expect(assigns(:subject_heading_type)).to eq(@subject_heading_type)
|
307
307
|
end
|
308
308
|
|
309
309
|
it "moves its position when specified" do
|
310
|
-
put :update, :
|
310
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @attrs, :move => 'lower'
|
311
311
|
response.should redirect_to(subject_heading_types_url)
|
312
312
|
end
|
313
313
|
end
|
314
314
|
|
315
315
|
describe "with invalid params" do
|
316
316
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
317
|
-
put :update, :
|
317
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @invalid_attrs
|
318
318
|
response.should render_template("edit")
|
319
319
|
end
|
320
320
|
end
|
@@ -325,11 +325,11 @@ describe SubjectHeadingTypesController do
|
|
325
325
|
|
326
326
|
describe "with valid params" do
|
327
327
|
it "updates the requested subject_heading_type" do
|
328
|
-
put :update, :
|
328
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @attrs
|
329
329
|
end
|
330
330
|
|
331
331
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
332
|
-
put :update, :
|
332
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @attrs
|
333
333
|
expect(assigns(:subject_heading_type)).to eq(@subject_heading_type)
|
334
334
|
response.should be_forbidden
|
335
335
|
end
|
@@ -337,7 +337,7 @@ describe SubjectHeadingTypesController do
|
|
337
337
|
|
338
338
|
describe "with invalid params" do
|
339
339
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
340
|
-
put :update, :
|
340
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @invalid_attrs
|
341
341
|
response.should be_forbidden
|
342
342
|
end
|
343
343
|
end
|
@@ -348,11 +348,11 @@ describe SubjectHeadingTypesController do
|
|
348
348
|
|
349
349
|
describe "with valid params" do
|
350
350
|
it "updates the requested subject_heading_type" do
|
351
|
-
put :update, :
|
351
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @attrs
|
352
352
|
end
|
353
353
|
|
354
354
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
355
|
-
put :update, :
|
355
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @attrs
|
356
356
|
expect(assigns(:subject_heading_type)).to eq(@subject_heading_type)
|
357
357
|
response.should be_forbidden
|
358
358
|
end
|
@@ -360,7 +360,7 @@ describe SubjectHeadingTypesController do
|
|
360
360
|
|
361
361
|
describe "with invalid params" do
|
362
362
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
363
|
-
put :update, :
|
363
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @invalid_attrs
|
364
364
|
response.should be_forbidden
|
365
365
|
end
|
366
366
|
end
|
@@ -369,18 +369,18 @@ describe SubjectHeadingTypesController do
|
|
369
369
|
describe "When not logged in" do
|
370
370
|
describe "with valid params" do
|
371
371
|
it "updates the requested subject_heading_type" do
|
372
|
-
put :update, :
|
372
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @attrs
|
373
373
|
end
|
374
374
|
|
375
375
|
it "should be forbidden" do
|
376
|
-
put :update, :
|
376
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @attrs
|
377
377
|
response.should redirect_to(new_user_session_url)
|
378
378
|
end
|
379
379
|
end
|
380
380
|
|
381
381
|
describe "with invalid params" do
|
382
382
|
it "assigns the requested subject_heading_type as @subject_heading_type" do
|
383
|
-
put :update, :
|
383
|
+
put :update, id: @subject_heading_type.id, subject_heading_type: @invalid_attrs
|
384
384
|
response.should redirect_to(new_user_session_url)
|
385
385
|
end
|
386
386
|
end
|
@@ -396,11 +396,11 @@ describe SubjectHeadingTypesController do
|
|
396
396
|
login_admin
|
397
397
|
|
398
398
|
it "destroys the requested subject_heading_type" do
|
399
|
-
delete :destroy, :
|
399
|
+
delete :destroy, id: @subject_heading_type.id
|
400
400
|
end
|
401
401
|
|
402
402
|
it "redirects to the subject_heading_types list" do
|
403
|
-
delete :destroy, :
|
403
|
+
delete :destroy, id: @subject_heading_type.id
|
404
404
|
response.should redirect_to(subject_heading_types_url)
|
405
405
|
end
|
406
406
|
end
|
@@ -409,11 +409,11 @@ describe SubjectHeadingTypesController do
|
|
409
409
|
login_librarian
|
410
410
|
|
411
411
|
it "destroys the requested subject_heading_type" do
|
412
|
-
delete :destroy, :
|
412
|
+
delete :destroy, id: @subject_heading_type.id
|
413
413
|
end
|
414
414
|
|
415
415
|
it "should be forbidden" do
|
416
|
-
delete :destroy, :
|
416
|
+
delete :destroy, id: @subject_heading_type.id
|
417
417
|
response.should be_forbidden
|
418
418
|
end
|
419
419
|
end
|
@@ -422,22 +422,22 @@ describe SubjectHeadingTypesController do
|
|
422
422
|
login_user
|
423
423
|
|
424
424
|
it "destroys the requested subject_heading_type" do
|
425
|
-
delete :destroy, :
|
425
|
+
delete :destroy, id: @subject_heading_type.id
|
426
426
|
end
|
427
427
|
|
428
428
|
it "should be forbidden" do
|
429
|
-
delete :destroy, :
|
429
|
+
delete :destroy, id: @subject_heading_type.id
|
430
430
|
response.should be_forbidden
|
431
431
|
end
|
432
432
|
end
|
433
433
|
|
434
434
|
describe "When not logged in" do
|
435
435
|
it "destroys the requested subject_heading_type" do
|
436
|
-
delete :destroy, :
|
436
|
+
delete :destroy, id: @subject_heading_type.id
|
437
437
|
end
|
438
438
|
|
439
439
|
it "should be forbidden" do
|
440
|
-
delete :destroy, :
|
440
|
+
delete :destroy, id: @subject_heading_type.id
|
441
441
|
response.should redirect_to(new_user_session_url)
|
442
442
|
end
|
443
443
|
end
|
@@ -19,7 +19,7 @@ describe SubjectTypesController do
|
|
19
19
|
|
20
20
|
it "assigns all subject_types as @subject_types" do
|
21
21
|
get :index
|
22
|
-
expect(assigns(:subject_types)).to eq(SubjectType.
|
22
|
+
expect(assigns(:subject_types)).to eq(SubjectType.order(:position))
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -28,7 +28,7 @@ describe SubjectTypesController do
|
|
28
28
|
|
29
29
|
it "assigns all subject_types as @subject_types" do
|
30
30
|
get :index
|
31
|
-
expect(assigns(:subject_types)).to eq(SubjectType.
|
31
|
+
expect(assigns(:subject_types)).to eq(SubjectType.order(:position))
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -37,7 +37,7 @@ describe SubjectTypesController do
|
|
37
37
|
|
38
38
|
it "assigns all subject_types as @subject_types" do
|
39
39
|
get :index
|
40
|
-
expect(assigns(:subject_types)).to
|
40
|
+
expect(assigns(:subject_types)).to be_nil
|
41
41
|
response.should be_forbidden
|
42
42
|
end
|
43
43
|
end
|
@@ -45,7 +45,7 @@ describe SubjectTypesController do
|
|
45
45
|
describe "When not logged in" do
|
46
46
|
it "assigns all subject_types as @subject_types" do
|
47
47
|
get :index
|
48
|
-
expect(assigns(:subject_types)).to
|
48
|
+
expect(assigns(:subject_types)).to be_nil
|
49
49
|
response.should redirect_to(new_user_session_url)
|
50
50
|
end
|
51
51
|
end
|
@@ -107,7 +107,7 @@ describe SubjectTypesController do
|
|
107
107
|
|
108
108
|
it "should not assign the requested subject_type as @subject_type" do
|
109
109
|
get :new
|
110
|
-
expect(assigns(:subject_type)).
|
110
|
+
expect(assigns(:subject_type)).to be_nil
|
111
111
|
response.should be_forbidden
|
112
112
|
end
|
113
113
|
end
|
@@ -117,7 +117,7 @@ describe SubjectTypesController do
|
|
117
117
|
|
118
118
|
it "should not assign the requested subject_type as @subject_type" do
|
119
119
|
get :new
|
120
|
-
expect(assigns(:subject_type)).
|
120
|
+
expect(assigns(:subject_type)).to be_nil
|
121
121
|
response.should be_forbidden
|
122
122
|
end
|
123
123
|
end
|
@@ -125,7 +125,7 @@ describe SubjectTypesController do
|
|
125
125
|
describe "When not logged in" do
|
126
126
|
it "should not assign the requested subject_type as @subject_type" do
|
127
127
|
get :new
|
128
|
-
expect(assigns(:subject_type)).
|
128
|
+
expect(assigns(:subject_type)).to be_nil
|
129
129
|
response.should redirect_to(new_user_session_url)
|
130
130
|
end
|
131
131
|
end
|
@@ -211,7 +211,7 @@ describe SubjectTypesController do
|
|
211
211
|
describe "with valid params" do
|
212
212
|
it "assigns a newly created subject_type as @subject_type" do
|
213
213
|
post :create, :subject_type => @attrs
|
214
|
-
expect(assigns(:subject_type)).to
|
214
|
+
expect(assigns(:subject_type)).to be_nil
|
215
215
|
end
|
216
216
|
|
217
217
|
it "should be forbidden" do
|
@@ -223,7 +223,7 @@ describe SubjectTypesController do
|
|
223
223
|
describe "with invalid params" do
|
224
224
|
it "assigns a newly created but unsaved subject_type as @subject_type" do
|
225
225
|
post :create, :subject_type => @invalid_attrs
|
226
|
-
expect(assigns(:subject_type)).
|
226
|
+
expect(assigns(:subject_type)).to be_nil
|
227
227
|
end
|
228
228
|
|
229
229
|
it "should be forbidden" do
|
@@ -239,7 +239,7 @@ describe SubjectTypesController do
|
|
239
239
|
describe "with valid params" do
|
240
240
|
it "assigns a newly created subject_type as @subject_type" do
|
241
241
|
post :create, :subject_type => @attrs
|
242
|
-
expect(assigns(:subject_type)).to
|
242
|
+
expect(assigns(:subject_type)).to be_nil
|
243
243
|
end
|
244
244
|
|
245
245
|
it "should be forbidden" do
|
@@ -251,7 +251,7 @@ describe SubjectTypesController do
|
|
251
251
|
describe "with invalid params" do
|
252
252
|
it "assigns a newly created but unsaved subject_type as @subject_type" do
|
253
253
|
post :create, :subject_type => @invalid_attrs
|
254
|
-
expect(assigns(:subject_type)).
|
254
|
+
expect(assigns(:subject_type)).to be_nil
|
255
255
|
end
|
256
256
|
|
257
257
|
it "should be forbidden" do
|
@@ -265,7 +265,7 @@ describe SubjectTypesController do
|
|
265
265
|
describe "with valid params" do
|
266
266
|
it "assigns a newly created subject_type as @subject_type" do
|
267
267
|
post :create, :subject_type => @attrs
|
268
|
-
expect(assigns(:subject_type)).to
|
268
|
+
expect(assigns(:subject_type)).to be_nil
|
269
269
|
end
|
270
270
|
|
271
271
|
it "should be forbidden" do
|
@@ -277,7 +277,7 @@ describe SubjectTypesController do
|
|
277
277
|
describe "with invalid params" do
|
278
278
|
it "assigns a newly created but unsaved subject_type as @subject_type" do
|
279
279
|
post :create, :subject_type => @invalid_attrs
|
280
|
-
expect(assigns(:subject_type)).
|
280
|
+
expect(assigns(:subject_type)).to be_nil
|
281
281
|
end
|
282
282
|
|
283
283
|
it "should be forbidden" do
|
@@ -103,7 +103,7 @@ describe SubjectsController do
|
|
103
103
|
|
104
104
|
it "assigns the requested subject as @subject" do
|
105
105
|
get :new
|
106
|
-
expect(assigns(:subject)).
|
106
|
+
expect(assigns(:subject)).to be_nil
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -112,7 +112,7 @@ describe SubjectsController do
|
|
112
112
|
|
113
113
|
it "should not assign the requested subject as @subject" do
|
114
114
|
get :new
|
115
|
-
expect(assigns(:subject)).
|
115
|
+
expect(assigns(:subject)).to be_nil
|
116
116
|
response.should be_forbidden
|
117
117
|
end
|
118
118
|
end
|
@@ -120,7 +120,7 @@ describe SubjectsController do
|
|
120
120
|
describe "When not logged in" do
|
121
121
|
it "should not assign the requested subject as @subject" do
|
122
122
|
get :new
|
123
|
-
expect(assigns(:subject)).
|
123
|
+
expect(assigns(:subject)).to be_nil
|
124
124
|
response.should redirect_to(new_user_session_url)
|
125
125
|
end
|
126
126
|
end
|
@@ -206,7 +206,7 @@ describe SubjectsController do
|
|
206
206
|
describe "with valid params" do
|
207
207
|
it "assigns a newly created subject as @subject" do
|
208
208
|
post :create, :subject => @attrs
|
209
|
-
expect(assigns(:subject)).to
|
209
|
+
expect(assigns(:subject)).to be_nil
|
210
210
|
end
|
211
211
|
|
212
212
|
it "should be forbidden" do
|
@@ -218,7 +218,7 @@ describe SubjectsController do
|
|
218
218
|
describe "with invalid params" do
|
219
219
|
it "assigns a newly created but unsaved subject as @subject" do
|
220
220
|
post :create, :subject => @invalid_attrs
|
221
|
-
expect(assigns(:subject)).
|
221
|
+
expect(assigns(:subject)).to be_nil
|
222
222
|
end
|
223
223
|
|
224
224
|
it "should be forbidden" do
|
@@ -234,7 +234,7 @@ describe SubjectsController do
|
|
234
234
|
describe "with valid params" do
|
235
235
|
it "assigns a newly created subject as @subject" do
|
236
236
|
post :create, :subject => @attrs
|
237
|
-
expect(assigns(:subject)).to
|
237
|
+
expect(assigns(:subject)).to be_nil
|
238
238
|
end
|
239
239
|
|
240
240
|
it "should be forbidden" do
|
@@ -246,7 +246,7 @@ describe SubjectsController do
|
|
246
246
|
describe "with invalid params" do
|
247
247
|
it "assigns a newly created but unsaved subject as @subject" do
|
248
248
|
post :create, :subject => @invalid_attrs
|
249
|
-
expect(assigns(:subject)).
|
249
|
+
expect(assigns(:subject)).to be_nil
|
250
250
|
end
|
251
251
|
|
252
252
|
it "should be forbidden" do
|
@@ -260,7 +260,7 @@ describe SubjectsController do
|
|
260
260
|
describe "with valid params" do
|
261
261
|
it "assigns a newly created subject as @subject" do
|
262
262
|
post :create, :subject => @attrs
|
263
|
-
expect(assigns(:subject)).to
|
263
|
+
expect(assigns(:subject)).to be_nil
|
264
264
|
end
|
265
265
|
|
266
266
|
it "should be forbidden" do
|
@@ -272,7 +272,7 @@ describe SubjectsController do
|
|
272
272
|
describe "with invalid params" do
|
273
273
|
it "assigns a newly created but unsaved subject as @subject" do
|
274
274
|
post :create, :subject => @invalid_attrs
|
275
|
-
expect(assigns(:subject)).
|
275
|
+
expect(assigns(:subject)).to be_nil
|
276
276
|
end
|
277
277
|
|
278
278
|
it "should be forbidden" do
|
@@ -1,8 +1,12 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
2
|
protect_from_forgery
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
include EnjuLeaf::Controller
|
5
|
+
include EnjuBiblio::Controller
|
6
|
+
include EnjuLibrary::Controller
|
7
|
+
include EnjuSubject::Controller
|
8
|
+
before_action :set_paper_trail_whodunnit
|
9
|
+
after_action :verify_authorized
|
10
|
+
|
11
|
+
include Pundit
|
8
12
|
end
|
@@ -2,8 +2,9 @@ require File.expand_path('../boot', __FILE__)
|
|
2
2
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
|
-
Bundler.require
|
6
|
-
require
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require 'enju_leaf'
|
7
|
+
require 'enju_subject'
|
7
8
|
|
8
9
|
module Dummy
|
9
10
|
class Application < Rails::Application
|
@@ -11,16 +12,6 @@ module Dummy
|
|
11
12
|
# Application configuration should go into files in config/initializers
|
12
13
|
# -- all .rb files in that directory are automatically loaded.
|
13
14
|
|
14
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
15
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
16
|
-
|
17
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
18
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
19
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
20
|
-
|
21
|
-
# Activate observers that should always be running.
|
22
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
23
|
-
|
24
15
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
25
16
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
26
17
|
# config.time_zone = 'Central Time (US & Canada)'
|
@@ -29,18 +20,8 @@ module Dummy
|
|
29
20
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
30
21
|
# config.i18n.default_locale = :de
|
31
22
|
|
32
|
-
#
|
33
|
-
config.
|
34
|
-
|
35
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
36
|
-
config.filter_parameters += [:password]
|
37
|
-
|
38
|
-
# Enable the asset pipeline
|
39
|
-
config.assets.enabled = true
|
40
|
-
|
41
|
-
# Version of your assets, change this if you want to expire all your assets
|
42
|
-
config.assets.version = '1.0'
|
23
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
24
|
+
config.active_record.raise_in_transactional_callbacks = true
|
43
25
|
end
|
44
26
|
end
|
45
27
|
|
46
|
-
require 'enju_leaf'
|