enju_subject 0.1.0.pre13 → 0.1.0.pre14

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.
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,439 +0,0 @@
1
- require 'spec_helper'
2
- require 'sunspot/rails/spec_helper'
3
-
4
- describe WorkHasSubjectsController do
5
- fixtures :all
6
- disconnect_sunspot
7
-
8
- describe "GET index" do
9
- before(:each) do
10
- FactoryGirl.create(:work_has_subject)
11
- end
12
-
13
- describe "When logged in as Administrator" do
14
- login_admin
15
-
16
- it "assigns all work_has_subjects as @work_has_subjects" do
17
- get :index
18
- assigns(:work_has_subjects).should eq(WorkHasSubject.all)
19
- end
20
- end
21
-
22
- describe "When logged in as Librarian" do
23
- login_librarian
24
-
25
- it "assigns all work_has_subjects as @work_has_subjects" do
26
- get :index
27
- assigns(:work_has_subjects).should eq(WorkHasSubject.all)
28
- end
29
- end
30
-
31
- describe "When logged in as User" do
32
- login_user
33
-
34
- it "assigns all work_has_subjects as @work_has_subjects" do
35
- get :index
36
- assigns(:work_has_subjects).should eq(WorkHasSubject.all)
37
- end
38
- end
39
-
40
- describe "When not logged in" do
41
- it "assigns all work_has_subjects as @work_has_subjects" do
42
- get :index
43
- assigns(:work_has_subjects).should eq(WorkHasSubject.all)
44
- end
45
- end
46
- end
47
-
48
- describe "GET show" do
49
- describe "When logged in as Administrator" do
50
- login_admin
51
-
52
- it "assigns the requested work_has_subject as @work_has_subject" do
53
- work_has_subject = FactoryGirl.create(:work_has_subject)
54
- get :show, :id => work_has_subject.id
55
- assigns(:work_has_subject).should eq(work_has_subject)
56
- end
57
- end
58
-
59
- describe "When logged in as Librarian" do
60
- login_librarian
61
-
62
- it "assigns the requested work_has_subject as @work_has_subject" do
63
- work_has_subject = FactoryGirl.create(:work_has_subject)
64
- get :show, :id => work_has_subject.id
65
- assigns(:work_has_subject).should eq(work_has_subject)
66
- end
67
- end
68
-
69
- describe "When logged in as User" do
70
- login_user
71
-
72
- it "assigns the requested work_has_subject as @work_has_subject" do
73
- work_has_subject = FactoryGirl.create(:work_has_subject)
74
- get :show, :id => work_has_subject.id
75
- assigns(:work_has_subject).should eq(work_has_subject)
76
- end
77
- end
78
-
79
- describe "When not logged in" do
80
- it "assigns the requested work_has_subject as @work_has_subject" do
81
- work_has_subject = FactoryGirl.create(:work_has_subject)
82
- get :show, :id => work_has_subject.id
83
- assigns(:work_has_subject).should eq(work_has_subject)
84
- end
85
- end
86
- end
87
-
88
- describe "GET new" do
89
- describe "When logged in as Administrator" do
90
- login_admin
91
-
92
- it "assigns the requested work_has_subject as @work_has_subject" do
93
- get :new
94
- assigns(:work_has_subject).should_not be_valid
95
- end
96
- end
97
-
98
- describe "When logged in as Librarian" do
99
- login_librarian
100
-
101
- it "assigns the requested work_has_subject as @work_has_subject" do
102
- get :new
103
- assigns(:work_has_subject).should_not be_valid
104
- end
105
- end
106
-
107
- describe "When logged in as User" do
108
- login_user
109
-
110
- it "should not assign the requested work_has_subject as @work_has_subject" do
111
- get :new
112
- assigns(:work_has_subject).should_not be_valid
113
- response.should be_forbidden
114
- end
115
- end
116
-
117
- describe "When not logged in" do
118
- it "should not assign the requested work_has_subject as @work_has_subject" do
119
- get :new
120
- assigns(:work_has_subject).should_not be_valid
121
- response.should redirect_to(new_user_session_url)
122
- end
123
- end
124
- end
125
-
126
- describe "GET edit" do
127
- describe "When logged in as Administrator" do
128
- login_admin
129
-
130
- it "assigns the requested work_has_subject as @work_has_subject" do
131
- work_has_subject = FactoryGirl.create(:work_has_subject)
132
- get :edit, :id => work_has_subject.id
133
- assigns(:work_has_subject).should eq(work_has_subject)
134
- end
135
- end
136
-
137
- describe "When logged in as Librarian" do
138
- login_librarian
139
-
140
- it "assigns the requested work_has_subject as @work_has_subject" do
141
- work_has_subject = FactoryGirl.create(:work_has_subject)
142
- get :edit, :id => work_has_subject.id
143
- assigns(:work_has_subject).should eq(work_has_subject)
144
- end
145
- end
146
-
147
- describe "When logged in as User" do
148
- login_user
149
-
150
- it "assigns the requested work_has_subject as @work_has_subject" do
151
- work_has_subject = FactoryGirl.create(:work_has_subject)
152
- get :edit, :id => work_has_subject.id
153
- response.should be_forbidden
154
- end
155
- end
156
-
157
- describe "When not logged in" do
158
- it "should not assign the requested work_has_subject as @work_has_subject" do
159
- work_has_subject = FactoryGirl.create(:work_has_subject)
160
- get :edit, :id => work_has_subject.id
161
- response.should redirect_to(new_user_session_url)
162
- end
163
- end
164
- end
165
-
166
- describe "POST create" do
167
- before(:each) do
168
- @attrs = FactoryGirl.attributes_for(:work_has_subject)
169
- @invalid_attrs = {:work_id => ''}
170
- end
171
-
172
- describe "When logged in as Administrator" do
173
- login_admin
174
-
175
- describe "with valid params" do
176
- it "assigns a newly created work_has_subject as @work_has_subject" do
177
- post :create, :work_has_subject => @attrs
178
- assigns(:work_has_subject).should be_valid
179
- end
180
-
181
- it "redirects to the created work_has_subject" do
182
- post :create, :work_has_subject => @attrs
183
- response.should redirect_to(work_has_subject_url(assigns(:work_has_subject)))
184
- end
185
- end
186
-
187
- describe "with invalid params" do
188
- it "assigns a newly created but unsaved work_has_subject as @work_has_subject" do
189
- post :create, :work_has_subject => @invalid_attrs
190
- assigns(:work_has_subject).should_not be_valid
191
- end
192
-
193
- it "re-renders the 'new' template" do
194
- post :create, :work_has_subject => @invalid_attrs
195
- response.should render_template("new")
196
- end
197
- end
198
- end
199
-
200
- describe "When logged in as Librarian" do
201
- login_librarian
202
-
203
- describe "with valid params" do
204
- it "assigns a newly created work_has_subject as @work_has_subject" do
205
- post :create, :work_has_subject => @attrs
206
- assigns(:work_has_subject).should be_valid
207
- end
208
-
209
- it "redirects to the created work_has_subject" do
210
- post :create, :work_has_subject => @attrs
211
- response.should redirect_to(work_has_subject_url(assigns(:work_has_subject)))
212
- end
213
- end
214
-
215
- describe "with invalid params" do
216
- it "assigns a newly created but unsaved work_has_subject as @work_has_subject" do
217
- post :create, :work_has_subject => @invalid_attrs
218
- assigns(:work_has_subject).should_not be_valid
219
- end
220
-
221
- it "re-renders the 'new' template" do
222
- post :create, :work_has_subject => @invalid_attrs
223
- response.should render_template("new")
224
- end
225
- end
226
- end
227
-
228
- describe "When logged in as User" do
229
- login_user
230
-
231
- describe "with valid params" do
232
- it "assigns a newly created work_has_subject as @work_has_subject" do
233
- post :create, :work_has_subject => @attrs
234
- assigns(:work_has_subject).should be_valid
235
- end
236
-
237
- it "should be forbidden" do
238
- post :create, :work_has_subject => @attrs
239
- response.should be_forbidden
240
- end
241
- end
242
-
243
- describe "with invalid params" do
244
- it "assigns a newly created but unsaved work_has_subject as @work_has_subject" do
245
- post :create, :work_has_subject => @invalid_attrs
246
- assigns(:work_has_subject).should_not be_valid
247
- end
248
-
249
- it "should be forbidden" do
250
- post :create, :work_has_subject => @invalid_attrs
251
- response.should be_forbidden
252
- end
253
- end
254
- end
255
-
256
- describe "When not logged in" do
257
- describe "with valid params" do
258
- it "assigns a newly created work_has_subject as @work_has_subject" do
259
- post :create, :work_has_subject => @attrs
260
- assigns(:work_has_subject).should be_valid
261
- end
262
-
263
- it "should be forbidden" do
264
- post :create, :work_has_subject => @attrs
265
- response.should redirect_to(new_user_session_url)
266
- end
267
- end
268
-
269
- describe "with invalid params" do
270
- it "assigns a newly created but unsaved work_has_subject as @work_has_subject" do
271
- post :create, :work_has_subject => @invalid_attrs
272
- assigns(:work_has_subject).should_not be_valid
273
- end
274
-
275
- it "should be forbidden" do
276
- post :create, :work_has_subject => @invalid_attrs
277
- response.should redirect_to(new_user_session_url)
278
- end
279
- end
280
- end
281
- end
282
-
283
- describe "PUT update" do
284
- before(:each) do
285
- @work_has_subject = FactoryGirl.create(:work_has_subject)
286
- @attrs = FactoryGirl.attributes_for(:work_has_subject)
287
- @invalid_attrs = {:work_id => ''}
288
- end
289
-
290
- describe "When logged in as Administrator" do
291
- login_admin
292
-
293
- describe "with valid params" do
294
- it "updates the requested work_has_subject" do
295
- put :update, :id => @work_has_subject.id, :work_has_subject => @attrs
296
- end
297
-
298
- it "assigns the requested work_has_subject as @work_has_subject" do
299
- put :update, :id => @work_has_subject.id, :work_has_subject => @attrs
300
- assigns(:work_has_subject).should eq(@work_has_subject)
301
- end
302
- end
303
-
304
- describe "with invalid params" do
305
- it "assigns the requested work_has_subject as @work_has_subject" do
306
- put :update, :id => @work_has_subject.id, :work_has_subject => @invalid_attrs
307
- response.should render_template("edit")
308
- end
309
- end
310
- end
311
-
312
- describe "When logged in as Librarian" do
313
- login_librarian
314
-
315
- describe "with valid params" do
316
- it "updates the requested work_has_subject" do
317
- put :update, :id => @work_has_subject.id, :work_has_subject => @attrs
318
- end
319
-
320
- it "assigns the requested work_has_subject as @work_has_subject" do
321
- put :update, :id => @work_has_subject.id, :work_has_subject => @attrs
322
- assigns(:work_has_subject).should eq(@work_has_subject)
323
- response.should redirect_to(@work_has_subject)
324
- end
325
- end
326
-
327
- describe "with invalid params" do
328
- it "assigns the work_has_subject as @work_has_subject" do
329
- put :update, :id => @work_has_subject, :work_has_subject => @invalid_attrs
330
- assigns(:work_has_subject).should_not be_valid
331
- end
332
-
333
- it "re-renders the 'edit' template" do
334
- put :update, :id => @work_has_subject, :work_has_subject => @invalid_attrs
335
- response.should render_template("edit")
336
- end
337
- end
338
- end
339
-
340
- describe "When logged in as User" do
341
- login_user
342
-
343
- describe "with valid params" do
344
- it "updates the requested work_has_subject" do
345
- put :update, :id => @work_has_subject.id, :work_has_subject => @attrs
346
- end
347
-
348
- it "assigns the requested work_has_subject as @work_has_subject" do
349
- put :update, :id => @work_has_subject.id, :work_has_subject => @attrs
350
- assigns(:work_has_subject).should eq(@work_has_subject)
351
- response.should be_forbidden
352
- end
353
- end
354
-
355
- describe "with invalid params" do
356
- it "assigns the requested work_has_subject as @work_has_subject" do
357
- put :update, :id => @work_has_subject.id, :work_has_subject => @invalid_attrs
358
- response.should be_forbidden
359
- end
360
- end
361
- end
362
-
363
- describe "When not logged in" do
364
- describe "with valid params" do
365
- it "updates the requested work_has_subject" do
366
- put :update, :id => @work_has_subject.id, :work_has_subject => @attrs
367
- end
368
-
369
- it "should be forbidden" do
370
- put :update, :id => @work_has_subject.id, :work_has_subject => @attrs
371
- response.should redirect_to(new_user_session_url)
372
- end
373
- end
374
-
375
- describe "with invalid params" do
376
- it "assigns the requested work_has_subject as @work_has_subject" do
377
- put :update, :id => @work_has_subject.id, :work_has_subject => @invalid_attrs
378
- response.should redirect_to(new_user_session_url)
379
- end
380
- end
381
- end
382
- end
383
-
384
- describe "DELETE destroy" do
385
- before(:each) do
386
- @work_has_subject = FactoryGirl.create(:work_has_subject)
387
- end
388
-
389
- describe "When logged in as Administrator" do
390
- login_admin
391
-
392
- it "destroys the requested work_has_subject" do
393
- delete :destroy, :id => @work_has_subject.id
394
- end
395
-
396
- it "redirects to the work_has_subjects list" do
397
- delete :destroy, :id => @work_has_subject.id
398
- response.should redirect_to(work_has_subjects_url)
399
- end
400
- end
401
-
402
- describe "When logged in as Librarian" do
403
- login_librarian
404
-
405
- it "destroys the requested work_has_subject" do
406
- delete :destroy, :id => @work_has_subject.id
407
- end
408
-
409
- it "should be forbidden" do
410
- delete :destroy, :id => @work_has_subject.id
411
- response.should redirect_to(work_has_subjects_url)
412
- end
413
- end
414
-
415
- describe "When logged in as User" do
416
- login_user
417
-
418
- it "destroys the requested work_has_subject" do
419
- delete :destroy, :id => @work_has_subject.id
420
- end
421
-
422
- it "should be forbidden" do
423
- delete :destroy, :id => @work_has_subject.id
424
- response.should be_forbidden
425
- end
426
- end
427
-
428
- describe "When not logged in" do
429
- it "destroys the requested work_has_subject" do
430
- delete :destroy, :id => @work_has_subject.id
431
- end
432
-
433
- it "should be forbidden" do
434
- delete :destroy, :id => @work_has_subject.id
435
- response.should redirect_to(new_user_session_url)
436
- end
437
- end
438
- end
439
- end
@@ -1,6 +0,0 @@
1
- FactoryGirl.define do
2
- factory :work_has_subject do |f|
3
- f.work_id{FactoryGirl.create(:manifestation).id}
4
- f.subject_id{FactoryGirl.create(:subject).id}
5
- end
6
- end
@@ -1,24 +0,0 @@
1
- # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
-
3
- one:
4
- subject_id: 1
5
- subject_type: Manifestation
6
- subject_heading_type_id: 1
7
-
8
- two:
9
- subject_id: 2
10
- subject_type: Manifestation
11
- subject_heading_type_id: 1
12
-
13
- # == Schema Information
14
- #
15
- # Table name: subject_heading_type_has_subjects
16
- #
17
- # id :integer not null, primary key
18
- # subject_id :integer not null
19
- # subject_type :string(255)
20
- # subject_heading_type_id :integer not null
21
- # created_at :datetime not null
22
- # updated_at :datetime not null
23
- #
24
-
@@ -1,33 +0,0 @@
1
- ---
2
- work_has_subject_00001:
3
- work_id: 1
4
- created_at: 2008-06-06 15:11:29.667289 +09:00
5
- updated_at: 2008-06-06 15:11:29.667289 +09:00
6
- subject_id: 1
7
- id: 1
8
- work_has_subject_00002:
9
- work_id: 1
10
- created_at: 2008-06-06 15:11:33.311274 +09:00
11
- updated_at: 2008-06-06 15:11:33.311274 +09:00
12
- subject_id: 2
13
- id: 2
14
- work_has_subject_00003:
15
- work_id: 1
16
- created_at: 2008-06-06 15:11:37.290715 +09:00
17
- updated_at: 2008-06-06 15:11:37.290715 +09:00
18
- subject_id: 3
19
- id: 3
20
-
21
- # == Schema Information
22
- #
23
- # Table name: work_has_subjects
24
- #
25
- # id :integer not null, primary key
26
- # subject_id :integer
27
- # subject_type :string(255)
28
- # work_id :integer
29
- # position :integer
30
- # created_at :datetime not null
31
- # updated_at :datetime not null
32
- #
33
-
@@ -1,20 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
3
-
4
- describe SubjectHeadingTypeHasSubject do
5
- #pending "add some examples to (or delete) #{__FILE__}"
6
-
7
- end
8
-
9
- # == Schema Information
10
- #
11
- # Table name: subject_heading_type_has_subjects
12
- #
13
- # id :integer not null, primary key
14
- # subject_id :integer not null
15
- # subject_type :string(255)
16
- # subject_heading_type_id :integer not null
17
- # created_at :datetime not null
18
- # updated_at :datetime not null
19
- #
20
-
@@ -1,21 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
3
-
4
- describe WorkHasSubject do
5
- #pending "add some examples to (or delete) #{__FILE__}"
6
-
7
- end
8
-
9
- # == Schema Information
10
- #
11
- # Table name: work_has_subjects
12
- #
13
- # id :integer not null, primary key
14
- # subject_id :integer
15
- # subject_type :string(255)
16
- # work_id :integer
17
- # position :integer
18
- # created_at :datetime not null
19
- # updated_at :datetime not null
20
- #
21
-