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