enju_library 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/enju_library/controller.rb +12 -3
  3. data/app/controllers/libraries_controller.rb +1 -0
  4. data/app/controllers/shelves_controller.rb +2 -1
  5. data/app/models/library.rb +1 -1
  6. data/app/models/library_group.rb +22 -17
  7. data/app/models/shelf.rb +1 -1
  8. data/app/views/libraries/_form.html.erb +1 -0
  9. data/app/views/library_groups/_color_fields.html.erb +0 -1
  10. data/app/views/library_groups/_form.html.erb +1 -4
  11. data/config/locales/translation_en.yml +1 -0
  12. data/config/locales/translation_ja.yml +1 -0
  13. data/config/routes.rb +1 -0
  14. data/lib/enju_library/version.rb +1 -1
  15. data/lib/tasks/enju_library_tasks.rake +2 -2
  16. data/spec/controllers/accepts_controller_spec.rb +96 -96
  17. data/spec/controllers/baskets_controller_spec.rb +126 -126
  18. data/spec/controllers/bookstores_controller_spec.rb +152 -152
  19. data/spec/controllers/budget_types_controller_spec.rb +48 -49
  20. data/spec/controllers/libraries_controller_spec.rb +183 -183
  21. data/spec/controllers/library_groups_controller_spec.rb +47 -47
  22. data/spec/controllers/request_status_types_controller_spec.rb +152 -152
  23. data/spec/controllers/request_types_controller_spec.rb +152 -152
  24. data/spec/controllers/search_engines_controller_spec.rb +152 -152
  25. data/spec/controllers/shelves_controller_spec.rb +152 -152
  26. data/spec/controllers/subscribes_controller_spec.rb +151 -151
  27. data/spec/controllers/subscriptions_controller_spec.rb +152 -152
  28. data/spec/controllers/user_export_files_controller_spec.rb +75 -75
  29. data/spec/controllers/user_groups_controller_spec.rb +108 -108
  30. data/spec/controllers/user_import_files_controller_spec.rb +73 -73
  31. data/spec/controllers/user_import_results_controller_spec.rb +33 -34
  32. data/spec/controllers/withdraws_controller_spec.rb +42 -45
  33. data/spec/fixtures/libraries.yml +1 -1
  34. data/spec/fixtures/library_groups.yml +22 -17
  35. data/spec/fixtures/shelves.yml +1 -1
  36. data/spec/models/library_group_spec.rb +22 -17
  37. data/spec/models/library_spec.rb +1 -1
  38. data/spec/models/shelf_spec.rb +1 -1
  39. data/spec/views/library_groups/edit.html.erb_spec.rb +8 -0
  40. metadata +11 -25
@@ -7,109 +7,109 @@ describe ShelvesController do
7
7
  FactoryGirl.attributes_for(:shelf)
8
8
  end
9
9
 
10
- describe "GET index", :solr => true do
10
+ describe 'GET index', solr: true do
11
11
  before do
12
12
  Shelf.reindex
13
13
  end
14
14
 
15
- describe "When logged in as Administrator" do
15
+ describe 'When logged in as Administrator' do
16
16
  login_fixture_admin
17
17
 
18
- it "assigns all shelves as @shelves" do
18
+ it 'assigns all shelves as @shelves' do
19
19
  get :index
20
20
  assigns(:shelves).should_not be_empty
21
21
  end
22
22
  end
23
23
 
24
- describe "When logged in as Librarian" do
24
+ describe 'When logged in as Librarian' do
25
25
  login_fixture_librarian
26
26
 
27
- it "assigns all shelves as @shelves" do
27
+ it 'assigns all shelves as @shelves' do
28
28
  get :index
29
29
  assigns(:shelves).should_not be_empty
30
30
  end
31
31
  end
32
32
 
33
- describe "When logged in as User" do
33
+ describe 'When logged in as User' do
34
34
  login_fixture_user
35
35
 
36
- it "assigns all shelves as @shelves" do
36
+ it 'assigns all shelves as @shelves' do
37
37
  get :index
38
38
  assigns(:shelves).should_not be_empty
39
39
  end
40
40
  end
41
41
 
42
- describe "When not logged in" do
43
- it "assigns all shelves as @shelves" do
42
+ describe 'When not logged in' do
43
+ it 'assigns all shelves as @shelves' do
44
44
  get :index
45
45
  assigns(:shelves).should_not be_empty
46
46
  response.should be_success
47
47
  end
48
48
 
49
- it "assigns all shelves as @shelves with library_id" do
50
- get :index, :library_id => 'kamata'
49
+ it 'assigns all shelves as @shelves with library_id' do
50
+ get :index, library_id: 'kamata'
51
51
  assigns(:shelves).map(&:id).should eq(Library.friendly.find('kamata').shelves.order(:position).page(1).pluck(:id))
52
52
  response.should be_success
53
53
  end
54
54
 
55
- it "assigns all shelves as @shelves with select mode" do
56
- get :index, :mode => 'select'
55
+ it 'assigns all shelves as @shelves with select mode' do
56
+ get :index, mode: 'select'
57
57
  assigns(:shelves).should eq(Shelf.real.order(:position))
58
58
  response.should be_success
59
59
  end
60
60
  end
61
61
  end
62
62
 
63
- describe "GET show" do
64
- describe "When logged in as Administrator" do
63
+ describe 'GET show' do
64
+ describe 'When logged in as Administrator' do
65
65
  login_fixture_admin
66
66
 
67
- it "assigns the requested shelf as @shelf" do
68
- get :show, :id => 1
67
+ it 'assigns the requested shelf as @shelf' do
68
+ get :show, id: 1
69
69
  assigns(:shelf).should eq(Shelf.find(1))
70
70
  end
71
71
  end
72
72
 
73
- describe "When not logged in" do
74
- it "assigns the requested shelf as @shelf" do
75
- get :show, :id => 1
73
+ describe 'When not logged in' do
74
+ it 'assigns the requested shelf as @shelf' do
75
+ get :show, id: 1
76
76
  assigns(:shelf).should eq(Shelf.find(1))
77
77
  end
78
78
  end
79
79
  end
80
80
 
81
- describe "GET new" do
82
- describe "When logged in as Administrator" do
81
+ describe 'GET new' do
82
+ describe 'When logged in as Administrator' do
83
83
  login_fixture_admin
84
84
 
85
- it "assigns the requested shelf as @shelf" do
85
+ it 'assigns the requested shelf as @shelf' do
86
86
  get :new
87
87
  assigns(:shelf).should_not be_valid
88
88
  end
89
89
  end
90
90
 
91
- describe "When logged in as Librarian" do
91
+ describe 'When logged in as Librarian' do
92
92
  login_fixture_librarian
93
93
 
94
- it "assigns the requested shelf as @shelf" do
94
+ it 'assigns the requested shelf as @shelf' do
95
95
  get :new
96
96
  assigns(:shelf).should be_nil
97
97
  response.should be_forbidden
98
98
  end
99
99
  end
100
100
 
101
- describe "When logged in as User" do
101
+ describe 'When logged in as User' do
102
102
  login_fixture_user
103
103
 
104
- it "should not assign the requested shelf as @shelf" do
104
+ it 'should not assign the requested shelf as @shelf' do
105
105
  get :new
106
106
  assigns(:shelf).should be_nil
107
107
  response.should be_forbidden
108
108
  end
109
109
  end
110
110
 
111
- describe "When not logged in" do
112
- it "should not assign the requested shelf as @shelf" do
111
+ describe 'When not logged in' do
112
+ it 'should not assign the requested shelf as @shelf' do
113
113
  get :new
114
114
  assigns(:shelf).should be_nil
115
115
  response.should redirect_to(new_user_session_url)
@@ -117,320 +117,320 @@ describe ShelvesController do
117
117
  end
118
118
  end
119
119
 
120
- describe "GET edit" do
121
- describe "When logged in as Administrator" do
120
+ describe 'GET edit' do
121
+ describe 'When logged in as Administrator' do
122
122
  login_fixture_admin
123
123
 
124
- it "assigns the requested shelf as @shelf" do
124
+ it 'assigns the requested shelf as @shelf' do
125
125
  shelf = FactoryGirl.create(:shelf)
126
- get :edit, :id => shelf.id
126
+ get :edit, id: shelf.id
127
127
  assigns(:shelf).should eq(shelf)
128
128
  end
129
129
  end
130
130
 
131
- describe "When logged in as Librarian" do
131
+ describe 'When logged in as Librarian' do
132
132
  login_fixture_librarian
133
133
 
134
- it "assigns the requested shelf as @shelf" do
134
+ it 'assigns the requested shelf as @shelf' do
135
135
  shelf = FactoryGirl.create(:shelf)
136
- get :edit, :id => shelf.id
136
+ get :edit, id: shelf.id
137
137
  assigns(:shelf).should eq(shelf)
138
138
  end
139
139
  end
140
140
 
141
- describe "When logged in as User" do
141
+ describe 'When logged in as User' do
142
142
  login_fixture_user
143
143
 
144
- it "assigns the requested shelf as @shelf" do
144
+ it 'assigns the requested shelf as @shelf' do
145
145
  shelf = FactoryGirl.create(:shelf)
146
- get :edit, :id => shelf.id
146
+ get :edit, id: shelf.id
147
147
  response.should be_forbidden
148
148
  end
149
149
  end
150
150
 
151
- describe "When not logged in" do
152
- it "should not assign the requested shelf as @shelf" do
151
+ describe 'When not logged in' do
152
+ it 'should not assign the requested shelf as @shelf' do
153
153
  shelf = FactoryGirl.create(:shelf)
154
- get :edit, :id => shelf.id
154
+ get :edit, id: shelf.id
155
155
  response.should redirect_to(new_user_session_url)
156
156
  end
157
157
  end
158
158
  end
159
159
 
160
- describe "POST create" do
160
+ describe 'POST create' do
161
161
  before(:each) do
162
162
  @attrs = valid_attributes
163
- @invalid_attrs = {:name => ''}
163
+ @invalid_attrs = { name: '' }
164
164
  end
165
165
 
166
- describe "When logged in as Administrator" do
166
+ describe 'When logged in as Administrator' do
167
167
  login_fixture_admin
168
168
 
169
- describe "with valid params" do
170
- it "assigns a newly created shelf as @shelf" do
171
- post :create, :shelf => @attrs
169
+ describe 'with valid params' do
170
+ it 'assigns a newly created shelf as @shelf' do
171
+ post :create, shelf: @attrs
172
172
  assigns(:shelf).should be_valid
173
173
  end
174
174
 
175
- it "redirects to the created patron" do
176
- post :create, :shelf => @attrs
175
+ it 'redirects to the created patron' do
176
+ post :create, shelf: @attrs
177
177
  response.should redirect_to(assigns(:shelf))
178
178
  end
179
179
  end
180
180
 
181
- describe "with invalid params" do
182
- it "assigns a newly created but unsaved shelf as @shelf" do
183
- post :create, :shelf => @invalid_attrs
181
+ describe 'with invalid params' do
182
+ it 'assigns a newly created but unsaved shelf as @shelf' do
183
+ post :create, shelf: @invalid_attrs
184
184
  assigns(:shelf).should_not be_valid
185
185
  end
186
186
 
187
- it "should be successful" do
188
- post :create, :shelf => @invalid_attrs
187
+ it 'should be successful' do
188
+ post :create, shelf: @invalid_attrs
189
189
  response.should be_success
190
190
  end
191
191
  end
192
192
  end
193
193
 
194
- describe "When logged in as Librarian" do
194
+ describe 'When logged in as Librarian' do
195
195
  login_fixture_librarian
196
196
 
197
- describe "with valid params" do
198
- it "assigns a newly created shelf as @shelf" do
199
- post :create, :shelf => @attrs
197
+ describe 'with valid params' do
198
+ it 'assigns a newly created shelf as @shelf' do
199
+ post :create, shelf: @attrs
200
200
  assigns(:shelf).should be_nil
201
201
  end
202
202
 
203
- it "should be forbidden" do
204
- post :create, :shelf => @attrs
203
+ it 'should be forbidden' do
204
+ post :create, shelf: @attrs
205
205
  response.should be_forbidden
206
206
  end
207
207
  end
208
208
 
209
- describe "with invalid params" do
210
- it "assigns a newly created but unsaved shelf as @shelf" do
211
- post :create, :shelf => @invalid_attrs
209
+ describe 'with invalid params' do
210
+ it 'assigns a newly created but unsaved shelf as @shelf' do
211
+ post :create, shelf: @invalid_attrs
212
212
  assigns(:shelf).should be_nil
213
213
  end
214
214
 
215
- it "should be forbidden" do
216
- post :create, :shelf => @invalid_attrs
215
+ it 'should be forbidden' do
216
+ post :create, shelf: @invalid_attrs
217
217
  response.should be_forbidden
218
218
  end
219
219
  end
220
220
  end
221
221
 
222
- describe "When logged in as User" do
222
+ describe 'When logged in as User' do
223
223
  login_fixture_user
224
224
 
225
- describe "with valid params" do
226
- it "assigns a newly created shelf as @shelf" do
227
- post :create, :shelf => @attrs
225
+ describe 'with valid params' do
226
+ it 'assigns a newly created shelf as @shelf' do
227
+ post :create, shelf: @attrs
228
228
  assigns(:shelf).should be_nil
229
229
  end
230
230
 
231
- it "should be forbidden" do
232
- post :create, :shelf => @attrs
231
+ it 'should be forbidden' do
232
+ post :create, shelf: @attrs
233
233
  response.should be_forbidden
234
234
  end
235
235
  end
236
236
 
237
- describe "with invalid params" do
238
- it "assigns a newly created but unsaved shelf as @shelf" do
239
- post :create, :shelf => @invalid_attrs
237
+ describe 'with invalid params' do
238
+ it 'assigns a newly created but unsaved shelf as @shelf' do
239
+ post :create, shelf: @invalid_attrs
240
240
  assigns(:shelf).should be_nil
241
241
  end
242
242
 
243
- it "should be forbidden" do
244
- post :create, :shelf => @invalid_attrs
243
+ it 'should be forbidden' do
244
+ post :create, shelf: @invalid_attrs
245
245
  response.should be_forbidden
246
246
  end
247
247
  end
248
248
  end
249
249
 
250
- describe "When not logged in" do
251
- describe "with valid params" do
252
- it "assigns a newly created shelf as @shelf" do
253
- post :create, :shelf => @attrs
250
+ describe 'When not logged in' do
251
+ describe 'with valid params' do
252
+ it 'assigns a newly created shelf as @shelf' do
253
+ post :create, shelf: @attrs
254
254
  assigns(:shelf).should be_nil
255
255
  end
256
256
 
257
- it "should be forbidden" do
258
- post :create, :shelf => @attrs
257
+ it 'should be forbidden' do
258
+ post :create, shelf: @attrs
259
259
  response.should redirect_to(new_user_session_url)
260
260
  end
261
261
  end
262
262
 
263
- describe "with invalid params" do
264
- it "assigns a newly created but unsaved shelf as @shelf" do
265
- post :create, :shelf => @invalid_attrs
263
+ describe 'with invalid params' do
264
+ it 'assigns a newly created but unsaved shelf as @shelf' do
265
+ post :create, shelf: @invalid_attrs
266
266
  assigns(:shelf).should be_nil
267
267
  end
268
268
 
269
- it "should be forbidden" do
270
- post :create, :shelf => @invalid_attrs
269
+ it 'should be forbidden' do
270
+ post :create, shelf: @invalid_attrs
271
271
  response.should redirect_to(new_user_session_url)
272
272
  end
273
273
  end
274
274
  end
275
275
  end
276
276
 
277
- describe "PUT update" do
277
+ describe 'PUT update' do
278
278
  before(:each) do
279
279
  @shelf = FactoryGirl.create(:shelf)
280
280
  @attrs = valid_attributes
281
- @invalid_attrs = {:name => ''}
281
+ @invalid_attrs = { name: '' }
282
282
  end
283
283
 
284
- describe "When logged in as Administrator" do
284
+ describe 'When logged in as Administrator' do
285
285
  login_fixture_admin
286
286
 
287
- describe "with valid params" do
288
- it "updates the requested shelf" do
289
- put :update, :id => @shelf.id, :shelf => @attrs
287
+ describe 'with valid params' do
288
+ it 'updates the requested shelf' do
289
+ put :update, id: @shelf.id, shelf: @attrs
290
290
  end
291
291
 
292
- it "assigns the requested shelf as @shelf" do
293
- put :update, :id => @shelf.id, :shelf => @attrs
292
+ it 'assigns the requested shelf as @shelf' do
293
+ put :update, id: @shelf.id, shelf: @attrs
294
294
  assigns(:shelf).should eq(@shelf)
295
295
  end
296
296
 
297
- it "moves its position when specified" do
298
- put :update, :id => @shelf.id, :shelf => @attrs, :move => 'lower'
297
+ it 'moves its position when specified' do
298
+ put :update, id: @shelf.id, shelf: @attrs, move: 'lower'
299
299
  response.should redirect_to(shelves_url(library_id: @shelf.library_id))
300
300
  end
301
301
  end
302
302
 
303
- describe "with invalid params" do
304
- it "assigns the requested shelf as @shelf" do
305
- put :update, :id => @shelf.id, :shelf => @invalid_attrs
306
- response.should render_template("edit")
303
+ describe 'with invalid params' do
304
+ it 'assigns the requested shelf as @shelf' do
305
+ put :update, id: @shelf.id, shelf: @invalid_attrs
306
+ response.should render_template('edit')
307
307
  end
308
308
  end
309
309
  end
310
310
 
311
- describe "When logged in as Librarian" do
311
+ describe 'When logged in as Librarian' do
312
312
  login_fixture_librarian
313
313
 
314
- describe "with valid params" do
315
- it "updates the requested shelf" do
316
- put :update, :id => @shelf.id, :shelf => @attrs
314
+ describe 'with valid params' do
315
+ it 'updates the requested shelf' do
316
+ put :update, id: @shelf.id, shelf: @attrs
317
317
  end
318
318
 
319
- it "assigns the requested shelf as @shelf" do
320
- put :update, :id => @shelf.id, :shelf => @attrs
319
+ it 'assigns the requested shelf as @shelf' do
320
+ put :update, id: @shelf.id, shelf: @attrs
321
321
  assigns(:shelf).should eq(@shelf)
322
322
  response.should be_forbidden
323
323
  end
324
324
  end
325
325
 
326
- describe "with invalid params" do
327
- it "assigns the requested shelf as @shelf" do
328
- put :update, :id => @shelf.id, :shelf => @invalid_attrs
326
+ describe 'with invalid params' do
327
+ it 'assigns the requested shelf as @shelf' do
328
+ put :update, id: @shelf.id, shelf: @invalid_attrs
329
329
  response.should be_forbidden
330
330
  end
331
331
  end
332
332
  end
333
333
 
334
- describe "When logged in as User" do
334
+ describe 'When logged in as User' do
335
335
  login_fixture_user
336
336
 
337
- describe "with valid params" do
338
- it "updates the requested shelf" do
339
- put :update, :id => @shelf.id, :shelf => @attrs
337
+ describe 'with valid params' do
338
+ it 'updates the requested shelf' do
339
+ put :update, id: @shelf.id, shelf: @attrs
340
340
  end
341
341
 
342
- it "assigns the requested shelf as @shelf" do
343
- put :update, :id => @shelf.id, :shelf => @attrs
342
+ it 'assigns the requested shelf as @shelf' do
343
+ put :update, id: @shelf.id, shelf: @attrs
344
344
  assigns(:shelf).should eq(@shelf)
345
345
  response.should be_forbidden
346
346
  end
347
347
  end
348
348
 
349
- describe "with invalid params" do
350
- it "assigns the requested shelf as @shelf" do
351
- put :update, :id => @shelf.id, :shelf => @invalid_attrs
349
+ describe 'with invalid params' do
350
+ it 'assigns the requested shelf as @shelf' do
351
+ put :update, id: @shelf.id, shelf: @invalid_attrs
352
352
  response.should be_forbidden
353
353
  end
354
354
  end
355
355
  end
356
356
 
357
- describe "When not logged in" do
358
- describe "with valid params" do
359
- it "updates the requested shelf" do
360
- put :update, :id => @shelf.id, :shelf => @attrs
357
+ describe 'When not logged in' do
358
+ describe 'with valid params' do
359
+ it 'updates the requested shelf' do
360
+ put :update, id: @shelf.id, shelf: @attrs
361
361
  end
362
362
 
363
- it "should be forbidden" do
364
- put :update, :id => @shelf.id, :shelf => @attrs
363
+ it 'should be forbidden' do
364
+ put :update, id: @shelf.id, shelf: @attrs
365
365
  response.should redirect_to(new_user_session_url)
366
366
  end
367
367
  end
368
368
 
369
- describe "with invalid params" do
370
- it "assigns the requested shelf as @shelf" do
371
- put :update, :id => @shelf.id, :shelf => @invalid_attrs
369
+ describe 'with invalid params' do
370
+ it 'assigns the requested shelf as @shelf' do
371
+ put :update, id: @shelf.id, shelf: @invalid_attrs
372
372
  response.should redirect_to(new_user_session_url)
373
373
  end
374
374
  end
375
375
  end
376
376
  end
377
377
 
378
- describe "DELETE destroy" do
378
+ describe 'DELETE destroy' do
379
379
  before(:each) do
380
380
  @shelf = FactoryGirl.create(:shelf)
381
381
  end
382
382
 
383
- describe "When logged in as Administrator" do
383
+ describe 'When logged in as Administrator' do
384
384
  login_fixture_admin
385
385
 
386
- it "destroys the requested shelf" do
387
- delete :destroy, :id => @shelf.id
386
+ it 'destroys the requested shelf' do
387
+ delete :destroy, id: @shelf.id
388
388
  end
389
389
 
390
- it "redirects to the shelves list" do
391
- delete :destroy, :id => @shelf.id
390
+ it 'redirects to the shelves list' do
391
+ delete :destroy, id: @shelf.id
392
392
  response.should redirect_to(shelves_url)
393
393
  end
394
394
 
395
- it "should not destroy a shelf that has id 1" do
396
- delete :destroy, :id => 1
395
+ it 'should not destroy a shelf that has id 1' do
396
+ delete :destroy, id: 1
397
397
  response.should be_forbidden
398
398
  end
399
399
  end
400
400
 
401
- describe "When logged in as Librarian" do
401
+ describe 'When logged in as Librarian' do
402
402
  login_fixture_librarian
403
403
 
404
- it "destroys the requested shelf" do
405
- delete :destroy, :id => @shelf.id
404
+ it 'destroys the requested shelf' do
405
+ delete :destroy, id: @shelf.id
406
406
  end
407
407
 
408
- it "should be forbidden" do
409
- delete :destroy, :id => @shelf.id
408
+ it 'should be forbidden' do
409
+ delete :destroy, id: @shelf.id
410
410
  response.should be_forbidden
411
411
  end
412
412
  end
413
413
 
414
- describe "When logged in as User" do
414
+ describe 'When logged in as User' do
415
415
  login_fixture_user
416
416
 
417
- it "destroys the requested shelf" do
418
- delete :destroy, :id => @shelf.id
417
+ it 'destroys the requested shelf' do
418
+ delete :destroy, id: @shelf.id
419
419
  end
420
420
 
421
- it "should be forbidden" do
422
- delete :destroy, :id => @shelf.id
421
+ it 'should be forbidden' do
422
+ delete :destroy, id: @shelf.id
423
423
  response.should be_forbidden
424
424
  end
425
425
  end
426
426
 
427
- describe "When not logged in" do
428
- it "destroys the requested shelf" do
429
- delete :destroy, :id => @shelf.id
427
+ describe 'When not logged in' do
428
+ it 'destroys the requested shelf' do
429
+ delete :destroy, id: @shelf.id
430
430
  end
431
431
 
432
- it "should be forbidden" do
433
- delete :destroy, :id => @shelf.id
432
+ it 'should be forbidden' do
433
+ delete :destroy, id: @shelf.id
434
434
  response.should redirect_to(new_user_session_url)
435
435
  end
436
436
  end