enju_subject 0.1.0.pre13 → 0.1.0.pre14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/subjects_controller.rb +3 -45
  3. data/app/models/enju_subject/ability.rb +4 -12
  4. data/app/models/subject.rb +4 -10
  5. data/app/models/subject_heading_type.rb +1 -3
  6. data/app/models/subject_sweeper.rb +1 -4
  7. data/app/views/manifestations/_subject_detail.html.erb +1 -1
  8. data/app/views/subjects/_form.html.erb +4 -14
  9. data/app/views/subjects/index.html.erb +44 -5
  10. data/app/views/subjects/show.html.erb +6 -36
  11. data/config/locales/translation_en.yml +0 -16
  12. data/config/locales/translation_ja.yml +1 -17
  13. data/config/routes.rb +4 -31
  14. data/db/migrate/20130504195916_add_subject_heading_type_id_to_subject.rb +5 -0
  15. data/lib/enju_subject/version.rb +1 -1
  16. data/lib/generators/enju_subject/setup/templates/db/fixtures/subject_heading_types.yml +31 -0
  17. data/spec/controllers/subjects_controller_spec.rb +0 -17
  18. data/spec/dummy/app/models/ability.rb +4 -12
  19. data/spec/dummy/db/development.sqlite3 +0 -0
  20. data/spec/dummy/db/schema.rb +5 -26
  21. data/spec/dummy/db/test.sqlite3 +0 -0
  22. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  23. data/spec/dummy/solr/data/test/index/segments_1ss +0 -0
  24. data/spec/fixtures/subjects.yml +5 -0
  25. data/spec/routing/subjects_routing_spec.rb +0 -4
  26. metadata +10 -37
  27. data/app/controllers/subject_heading_type_has_subjects_controller.rb +0 -80
  28. data/app/controllers/work_has_subjects_controller.rb +0 -107
  29. data/app/models/subject_heading_type_has_subject.rb +0 -22
  30. data/app/models/work_has_subject.rb +0 -32
  31. data/app/views/subjects/_index.html.erb +0 -48
  32. data/app/views/subjects/_index_work.html.erb +0 -60
  33. data/app/views/subjects/_show_work_list.html.erb +0 -15
  34. data/app/views/subjects/show.js.erb +0 -1
  35. data/app/views/work_has_subjects/_form.html.erb +0 -24
  36. data/app/views/work_has_subjects/edit.html.erb +0 -29
  37. data/app/views/work_has_subjects/index.html.erb +0 -31
  38. data/app/views/work_has_subjects/new.html.erb +0 -42
  39. data/app/views/work_has_subjects/show.html.erb +0 -25
  40. data/db/migrate/20080606052544_create_work_has_subjects.rb +0 -18
  41. data/db/migrate/20090208044541_create_subject_heading_type_has_subjects.rb +0 -16
  42. data/spec/controllers/subject_heading_type_has_subjects_controller_spec.rb +0 -447
  43. data/spec/controllers/work_has_subjects_controller_spec.rb +0 -439
  44. data/spec/dummy/solr/data/test/index/segments_1n5 +0 -0
  45. data/spec/factories/work_has_subject.rb +0 -6
  46. data/spec/fixtures/subject_heading_type_has_subjects.yml +0 -24
  47. data/spec/fixtures/work_has_subjects.yml +0 -33
  48. data/spec/models/subject_heading_type_has_subject_spec.rb +0 -20
  49. data/spec/models/work_has_subject_spec.rb +0 -21
@@ -1,447 +0,0 @@
1
- require 'spec_helper'
2
- require 'sunspot/rails/spec_helper'
3
-
4
- describe SubjectHeadingTypeHasSubjectsController do
5
- fixtures :all
6
- disconnect_sunspot
7
-
8
- def valid_attributes
9
- FactoryGirl.attributes_for(:subject_heading_type_has_subject)
10
- end
11
-
12
- describe "GET index" do
13
- before(:each) do
14
- FactoryGirl.create(:subject_heading_type_has_subject)
15
- end
16
-
17
- describe "When logged in as Administrator" do
18
- login_admin
19
-
20
- it "assigns all subject_heading_type_has_subjects as @subject_heading_type_has_subjects" do
21
- get :index
22
- assigns(:subject_heading_type_has_subjects).should eq(SubjectHeadingTypeHasSubject.all)
23
- end
24
- end
25
-
26
- describe "When logged in as Librarian" do
27
- login_librarian
28
-
29
- it "assigns all subject_heading_type_has_subjects as @subject_heading_type_has_subjects" do
30
- get :index
31
- assigns(:subject_heading_type_has_subjects).should eq(SubjectHeadingTypeHasSubject.all)
32
- end
33
- end
34
-
35
- describe "When logged in as Subject" do
36
- login_user
37
-
38
- it "assigns all subject_heading_type_has_subjects as @subject_heading_type_has_subjects" do
39
- get :index
40
- assigns(:subject_heading_type_has_subjects).should be_empty
41
- response.should be_forbidden
42
- end
43
- end
44
-
45
- describe "When not logged in" do
46
- it "assigns all subject_heading_type_has_subjects as @subject_heading_type_has_subjects" do
47
- get :index
48
- assigns(:subject_heading_type_has_subjects).should be_empty
49
- response.should redirect_to(new_user_session_url)
50
- end
51
- end
52
- end
53
-
54
- describe "GET show" do
55
- describe "When logged in as Administrator" do
56
- login_admin
57
-
58
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
59
- subject_heading_type_has_subject = FactoryGirl.create(:subject_heading_type_has_subject)
60
- get :show, :id => subject_heading_type_has_subject.id
61
- assigns(:subject_heading_type_has_subject).should eq(subject_heading_type_has_subject)
62
- end
63
- end
64
-
65
- describe "When logged in as Librarian" do
66
- login_librarian
67
-
68
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
69
- subject_heading_type_has_subject = FactoryGirl.create(:subject_heading_type_has_subject)
70
- get :show, :id => subject_heading_type_has_subject.id
71
- assigns(:subject_heading_type_has_subject).should eq(subject_heading_type_has_subject)
72
- end
73
- end
74
-
75
- describe "When logged in as Subject" do
76
- login_user
77
-
78
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
79
- subject_heading_type_has_subject = FactoryGirl.create(:subject_heading_type_has_subject)
80
- get :show, :id => subject_heading_type_has_subject.id
81
- assigns(:subject_heading_type_has_subject).should eq(subject_heading_type_has_subject)
82
- end
83
- end
84
-
85
- describe "When not logged in" do
86
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
87
- subject_heading_type_has_subject = FactoryGirl.create(:subject_heading_type_has_subject)
88
- get :show, :id => subject_heading_type_has_subject.id
89
- assigns(:subject_heading_type_has_subject).should eq(subject_heading_type_has_subject)
90
- end
91
- end
92
- end
93
-
94
- describe "GET new" do
95
- describe "When logged in as Administrator" do
96
- login_admin
97
-
98
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
99
- get :new
100
- assigns(:subject_heading_type_has_subject).should_not be_valid
101
- response.should be_success
102
- end
103
- end
104
-
105
- describe "When logged in as Librarian" do
106
- login_librarian
107
-
108
- it "should not assign the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
109
- get :new
110
- assigns(:subject_heading_type_has_subject).should_not be_valid
111
- response.should be_forbidden
112
- end
113
- end
114
-
115
- describe "When logged in as Subject" do
116
- login_user
117
-
118
- it "should not assign the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
119
- get :new
120
- assigns(:subject_heading_type_has_subject).should_not be_valid
121
- response.should be_forbidden
122
- end
123
- end
124
-
125
- describe "When not logged in" do
126
- it "should not assign the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
127
- get :new
128
- assigns(:subject_heading_type_has_subject).should_not be_valid
129
- response.should redirect_to(new_user_session_url)
130
- end
131
- end
132
- end
133
-
134
- describe "GET edit" do
135
- describe "When logged in as Administrator" do
136
- login_admin
137
-
138
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
139
- subject_heading_type_has_subject = FactoryGirl.create(:subject_heading_type_has_subject)
140
- get :edit, :id => subject_heading_type_has_subject.id
141
- assigns(:subject_heading_type_has_subject).should eq(subject_heading_type_has_subject)
142
- end
143
- end
144
-
145
- describe "When logged in as Librarian" do
146
- login_librarian
147
-
148
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
149
- subject_heading_type_has_subject = FactoryGirl.create(:subject_heading_type_has_subject)
150
- get :edit, :id => subject_heading_type_has_subject.id
151
- assigns(:subject_heading_type_has_subject).should eq(subject_heading_type_has_subject)
152
- end
153
- end
154
-
155
- describe "When logged in as Subject" do
156
- login_user
157
-
158
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
159
- subject_heading_type_has_subject = FactoryGirl.create(:subject_heading_type_has_subject)
160
- get :edit, :id => subject_heading_type_has_subject.id
161
- response.should be_forbidden
162
- end
163
- end
164
-
165
- describe "When not logged in" do
166
- it "should not assign the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
167
- subject_heading_type_has_subject = FactoryGirl.create(:subject_heading_type_has_subject)
168
- get :edit, :id => subject_heading_type_has_subject.id
169
- response.should redirect_to(new_user_session_url)
170
- end
171
- end
172
- end
173
-
174
- describe "POST create" do
175
- before(:each) do
176
- @attrs = valid_attributes
177
- @invalid_attrs = {:subject_heading_type_id => ''}
178
- end
179
-
180
- describe "When logged in as Administrator" do
181
- login_admin
182
-
183
- describe "with valid params" do
184
- it "assigns a newly created subject_heading_type_has_subject as @subject_heading_type_has_subject" do
185
- post :create, :subject_heading_type_has_subject => @attrs
186
- assigns(:subject_heading_type_has_subject).should be_valid
187
- end
188
-
189
- it "redirects to the created patron" do
190
- post :create, :subject_heading_type_has_subject => @attrs
191
- response.should redirect_to(assigns(:subject_heading_type_has_subject))
192
- end
193
- end
194
-
195
- describe "with invalid params" do
196
- it "assigns a newly created but unsaved subject_heading_type_has_subject as @subject_heading_type_has_subject" do
197
- post :create, :subject_heading_type_has_subject => @invalid_attrs
198
- assigns(:subject_heading_type_has_subject).should_not be_valid
199
- end
200
-
201
- it "re-renders the 'new' template" do
202
- post :create, :subject_heading_type_has_subject => @invalid_attrs
203
- response.should render_template("new")
204
- end
205
- end
206
- end
207
-
208
- describe "When logged in as Librarian" do
209
- login_librarian
210
-
211
- describe "with valid params" do
212
- it "assigns a newly created subject_heading_type_has_subject as @subject_heading_type_has_subject" do
213
- post :create, :subject_heading_type_has_subject => @attrs
214
- assigns(:subject_heading_type_has_subject).should be_valid
215
- end
216
-
217
- it "should be forbidden" do
218
- post :create, :subject_heading_type_has_subject => @attrs
219
- response.should be_forbidden
220
- end
221
- end
222
-
223
- describe "with invalid params" do
224
- it "assigns a newly created but unsaved subject_heading_type_has_subject as @subject_heading_type_has_subject" do
225
- post :create, :subject_heading_type_has_subject => @invalid_attrs
226
- assigns(:subject_heading_type_has_subject).should_not be_valid
227
- end
228
-
229
- it "should be forbidden" do
230
- post :create, :subject_heading_type_has_subject => @invalid_attrs
231
- response.should be_forbidden
232
- end
233
- end
234
- end
235
-
236
- describe "When logged in as Subject" do
237
- login_user
238
-
239
- describe "with valid params" do
240
- it "assigns a newly created subject_heading_type_has_subject as @subject_heading_type_has_subject" do
241
- post :create, :subject_heading_type_has_subject => @attrs
242
- assigns(:subject_heading_type_has_subject).should be_valid
243
- end
244
-
245
- it "should be forbidden" do
246
- post :create, :subject_heading_type_has_subject => @attrs
247
- response.should be_forbidden
248
- end
249
- end
250
-
251
- describe "with invalid params" do
252
- it "assigns a newly created but unsaved subject_heading_type_has_subject as @subject_heading_type_has_subject" do
253
- post :create, :subject_heading_type_has_subject => @invalid_attrs
254
- assigns(:subject_heading_type_has_subject).should_not be_valid
255
- end
256
-
257
- it "should be forbidden" do
258
- post :create, :subject_heading_type_has_subject => @invalid_attrs
259
- response.should be_forbidden
260
- end
261
- end
262
- end
263
-
264
- describe "When not logged in" do
265
- describe "with valid params" do
266
- it "assigns a newly created subject_heading_type_has_subject as @subject_heading_type_has_subject" do
267
- post :create, :subject_heading_type_has_subject => @attrs
268
- assigns(:subject_heading_type_has_subject).should be_valid
269
- end
270
-
271
- it "should be forbidden" do
272
- post :create, :subject_heading_type_has_subject => @attrs
273
- response.should redirect_to(new_user_session_url)
274
- end
275
- end
276
-
277
- describe "with invalid params" do
278
- it "assigns a newly created but unsaved subject_heading_type_has_subject as @subject_heading_type_has_subject" do
279
- post :create, :subject_heading_type_has_subject => @invalid_attrs
280
- assigns(:subject_heading_type_has_subject).should_not be_valid
281
- end
282
-
283
- it "should be forbidden" do
284
- post :create, :subject_heading_type_has_subject => @invalid_attrs
285
- response.should redirect_to(new_user_session_url)
286
- end
287
- end
288
- end
289
- end
290
-
291
- describe "PUT update" do
292
- before(:each) do
293
- @subject_heading_type_has_subject = FactoryGirl.create(:subject_heading_type_has_subject)
294
- @attrs = valid_attributes
295
- @invalid_attrs = {:subject_heading_type_id => ''}
296
- end
297
-
298
- describe "When logged in as Administrator" do
299
- login_admin
300
-
301
- describe "with valid params" do
302
- it "updates the requested subject_heading_type_has_subject" do
303
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @attrs
304
- end
305
-
306
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
307
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @attrs
308
- assigns(:subject_heading_type_has_subject).should eq(@subject_heading_type_has_subject)
309
- response.should redirect_to(@subject_heading_type_has_subject)
310
- end
311
- end
312
-
313
- describe "with invalid params" do
314
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
315
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @invalid_attrs
316
- response.should render_template("edit")
317
- end
318
- end
319
- end
320
-
321
- describe "When logged in as Librarian" do
322
- login_librarian
323
-
324
- describe "with valid params" do
325
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
326
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @attrs
327
- end
328
-
329
- it "should be forbidden" do
330
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @attrs
331
- response.should be_forbidden
332
- end
333
- end
334
-
335
- describe "with invalid params" do
336
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
337
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @invalid_attrs
338
- assigns(:subject_heading_type_has_subject).should eq(@subject_heading_type_has_subject)
339
- end
340
-
341
- it "should be forbidden" do
342
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @invalid_attrs
343
- response.should be_forbidden
344
- end
345
- end
346
- end
347
-
348
- describe "When logged in as Subject" do
349
- login_user
350
-
351
- describe "with valid params" do
352
- it "updates the requested subject_heading_type_has_subject" do
353
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @attrs
354
- end
355
-
356
- it "should be forbidden" do
357
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @attrs
358
- assigns(:subject_heading_type_has_subject).should eq(@subject_heading_type_has_subject)
359
- response.should be_forbidden
360
- end
361
- end
362
-
363
- describe "with invalid params" do
364
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
365
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @invalid_attrs
366
- response.should be_forbidden
367
- end
368
- end
369
- end
370
-
371
- describe "When not logged in" do
372
- describe "with valid params" do
373
- it "updates the requested subject_heading_type_has_subject" do
374
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @attrs
375
- end
376
-
377
- it "should be forbidden" do
378
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @attrs
379
- response.should redirect_to(new_user_session_url)
380
- end
381
- end
382
-
383
- describe "with invalid params" do
384
- it "assigns the requested subject_heading_type_has_subject as @subject_heading_type_has_subject" do
385
- put :update, :id => @subject_heading_type_has_subject.id, :subject_heading_type_has_subject => @invalid_attrs
386
- response.should redirect_to(new_user_session_url)
387
- end
388
- end
389
- end
390
- end
391
-
392
- describe "DELETE destroy" do
393
- before(:each) do
394
- @subject_heading_type_has_subject = FactoryGirl.create(:subject_heading_type_has_subject)
395
- end
396
-
397
- describe "When logged in as Administrator" do
398
- login_admin
399
-
400
- it "destroys the requested subject_heading_type_has_subject" do
401
- delete :destroy, :id => @subject_heading_type_has_subject.id
402
- end
403
-
404
- it "redirects to the subject_heading_type_has_subjects list" do
405
- delete :destroy, :id => @subject_heading_type_has_subject.id
406
- response.should redirect_to(subject_heading_type_has_subjects_url)
407
- end
408
- end
409
-
410
- describe "When logged in as Librarian" do
411
- login_librarian
412
-
413
- it "destroys the requested subject_heading_type_has_subject" do
414
- delete :destroy, :id => @subject_heading_type_has_subject.id
415
- end
416
-
417
- it "redirects to the subject_heading_type_has_subjects list" do
418
- delete :destroy, :id => @subject_heading_type_has_subject.id
419
- response.should be_forbidden
420
- end
421
- end
422
-
423
- describe "When logged in as Subject" do
424
- login_user
425
-
426
- it "destroys the requested subject_heading_type_has_subject" do
427
- delete :destroy, :id => @subject_heading_type_has_subject.id
428
- end
429
-
430
- it "should be forbidden" do
431
- delete :destroy, :id => @subject_heading_type_has_subject.id
432
- response.should be_forbidden
433
- end
434
- end
435
-
436
- describe "When not logged in" do
437
- it "destroys the requested subject_heading_type_has_subject" do
438
- delete :destroy, :id => @subject_heading_type_has_subject.id
439
- end
440
-
441
- it "should be forbidden" do
442
- delete :destroy, :id => @subject_heading_type_has_subject.id
443
- response.should redirect_to(new_user_session_url)
444
- end
445
- end
446
- end
447
- end