enju_library 0.2.0 → 0.2.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.
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
@@ -3,120 +3,120 @@ require 'rails_helper'
3
3
  describe BasketsController do
4
4
  fixtures :all
5
5
 
6
- describe "GET index" do
7
- describe "When logged in as Administrator" do
6
+ describe 'GET index' do
7
+ describe 'When logged in as Administrator' do
8
8
  login_fixture_admin
9
9
 
10
- it "assigns all baskets as @baskets" do
11
- get :index, :user_id => users(:user1).username
10
+ it 'assigns all baskets as @baskets' do
11
+ get :index, user_id: users(:user1).username
12
12
  assigns(:baskets).should_not be_empty
13
13
  response.should be_success
14
14
  end
15
15
 
16
- it "should get index without user_id" do
16
+ it 'should get index without user_id' do
17
17
  get :index
18
18
  response.should be_success
19
19
  end
20
20
  end
21
21
 
22
- describe "When logged in as Librarian" do
22
+ describe 'When logged in as Librarian' do
23
23
  login_fixture_librarian
24
24
 
25
- it "assigns all baskets as @baskets" do
26
- get :index, :user_id => users(:user1).username
25
+ it 'assigns all baskets as @baskets' do
26
+ get :index, user_id: users(:user1).username
27
27
  assigns(:baskets).should_not be_empty
28
28
  response.should be_success
29
29
  end
30
30
  end
31
31
 
32
- describe "When logged in as User" do
32
+ describe 'When logged in as User' do
33
33
  login_fixture_user
34
34
 
35
- it "assigns all baskets as @baskets" do
36
- get :index, :user_id => users(:user1).username
35
+ it 'assigns all baskets as @baskets' do
36
+ get :index, user_id: users(:user1).username
37
37
  assigns(:baskets).should be_nil
38
38
  response.should be_forbidden
39
39
  end
40
40
  end
41
41
 
42
- describe "When not logged in" do
43
- it "assigns all baskets as @baskets" do
44
- get :index, :user_id => users(:user1).username
42
+ describe 'When not logged in' do
43
+ it 'assigns all baskets as @baskets' do
44
+ get :index, user_id: users(:user1).username
45
45
  assigns(:baskets).should be_nil
46
46
  response.should redirect_to(new_user_session_url)
47
47
  end
48
48
  end
49
49
  end
50
50
 
51
- describe "GET show" do
52
- describe "When logged in as Administrator" do
51
+ describe 'GET show' do
52
+ describe 'When logged in as Administrator' do
53
53
  login_fixture_admin
54
54
 
55
- it "assigns the requested basket as @basket" do
56
- get :show, :id => 1, :user_id => users(:admin).username
55
+ it 'assigns the requested basket as @basket' do
56
+ get :show, id: 1, user_id: users(:admin).username
57
57
  assigns(:basket).should eq(Basket.find(1))
58
58
  end
59
59
  end
60
60
 
61
- describe "When logged in as Librarian" do
61
+ describe 'When logged in as Librarian' do
62
62
  login_fixture_librarian
63
63
 
64
- it "assigns the requested basket as @basket" do
65
- get :show, :id => 1, :user_id => users(:admin).username
64
+ it 'assigns the requested basket as @basket' do
65
+ get :show, id: 1, user_id: users(:admin).username
66
66
  assigns(:basket).should eq(Basket.find(1))
67
67
  end
68
68
  end
69
69
 
70
- describe "When logged in as User" do
70
+ describe 'When logged in as User' do
71
71
  login_fixture_user
72
72
 
73
- it "assigns the requested basket as @basket" do
74
- get :show, :id => 1, :user_id => users(:admin).username
73
+ it 'assigns the requested basket as @basket' do
74
+ get :show, id: 1, user_id: users(:admin).username
75
75
  assigns(:basket).should eq(Basket.find(1))
76
76
  response.should be_forbidden
77
77
  end
78
78
  end
79
79
 
80
- describe "When not logged in" do
81
- it "assigns the requested basket as @basket" do
82
- get :show, :id => 1, :user_id => users(:admin).username
80
+ describe 'When not logged in' do
81
+ it 'assigns the requested basket as @basket' do
82
+ get :show, id: 1, user_id: users(:admin).username
83
83
  assigns(:basket).should eq(Basket.find(1))
84
84
  response.should redirect_to(new_user_session_url)
85
85
  end
86
86
  end
87
87
  end
88
88
 
89
- describe "GET new" do
90
- describe "When logged in as Administrator" do
89
+ describe 'GET new' do
90
+ describe 'When logged in as Administrator' do
91
91
  login_fixture_admin
92
92
 
93
- it "assigns the requested basket as @basket" do
93
+ it 'assigns the requested basket as @basket' do
94
94
  get :new
95
95
  assigns(:basket).should_not be_valid
96
96
  end
97
97
  end
98
98
 
99
- describe "When logged in as Librarian" do
99
+ describe 'When logged in as Librarian' do
100
100
  login_fixture_librarian
101
101
 
102
- it "assigns the requested basket as @basket" do
102
+ it 'assigns the requested basket as @basket' do
103
103
  get :new
104
104
  assigns(:basket).should_not be_valid
105
105
  end
106
106
  end
107
107
 
108
- describe "When logged in as User" do
108
+ describe 'When logged in as User' do
109
109
  login_fixture_user
110
110
 
111
- it "should not assign the requested basket as @basket" do
111
+ it 'should not assign the requested basket as @basket' do
112
112
  get :new
113
113
  assigns(:basket).should be_nil
114
114
  response.should be_forbidden
115
115
  end
116
116
  end
117
117
 
118
- describe "When not logged in" do
119
- it "should not assign the requested basket as @basket" do
118
+ describe 'When not logged in' do
119
+ it 'should not assign the requested basket as @basket' do
120
120
  get :new
121
121
  assigns(:basket).should be_nil
122
122
  response.should redirect_to(new_user_session_url)
@@ -124,175 +124,175 @@ describe BasketsController do
124
124
  end
125
125
  end
126
126
 
127
- describe "GET edit" do
128
- describe "When logged in as Administrator" do
127
+ describe 'GET edit' do
128
+ describe 'When logged in as Administrator' do
129
129
  login_fixture_admin
130
130
  before(:each) do
131
131
  @basket = baskets(:basket_00001)
132
132
  end
133
133
 
134
- it "assigns the requested basket as @basket" do
135
- get :edit, :id => @basket.id
134
+ it 'assigns the requested basket as @basket' do
135
+ get :edit, id: @basket.id
136
136
  assigns(:basket).should eq(@basket)
137
137
  end
138
138
  end
139
139
 
140
- describe "When logged in as Librarian" do
140
+ describe 'When logged in as Librarian' do
141
141
  login_fixture_librarian
142
142
  before(:each) do
143
143
  @basket = baskets(:basket_00001)
144
144
  end
145
145
 
146
- it "assigns the requested basket as @basket" do
147
- get :edit, :id => @basket.id
146
+ it 'assigns the requested basket as @basket' do
147
+ get :edit, id: @basket.id
148
148
  assigns(:basket).should eq(@basket)
149
149
  end
150
150
  end
151
151
 
152
- describe "When logged in as User" do
152
+ describe 'When logged in as User' do
153
153
  login_fixture_user
154
154
  before(:each) do
155
155
  @basket = baskets(:basket_00001)
156
156
  end
157
157
 
158
- it "should not assign the requested basket as @basket" do
159
- get :edit, :id => @basket.id
158
+ it 'should not assign the requested basket as @basket' do
159
+ get :edit, id: @basket.id
160
160
  assigns(:basket).should eq(@basket)
161
161
  response.should be_forbidden
162
162
  end
163
163
  end
164
164
 
165
- describe "When not logged in" do
165
+ describe 'When not logged in' do
166
166
  before(:each) do
167
167
  @basket = baskets(:basket_00001)
168
168
  end
169
169
 
170
- it "should not assign the requested basket as @basket" do
171
- get :edit, :id => @basket.id
170
+ it 'should not assign the requested basket as @basket' do
171
+ get :edit, id: @basket.id
172
172
  assigns(:basket).should eq(@basket)
173
173
  response.should redirect_to new_user_session_url
174
174
  end
175
175
  end
176
176
  end
177
177
 
178
- describe "POST create" do
178
+ describe 'POST create' do
179
179
  before(:each) do
180
- @attrs = {:user_number => users(:user1).profile.user_number }
181
- @invalid_attrs = {:user_number => 'invalid'}
180
+ @attrs = { user_number: users(:user1).profile.user_number }
181
+ @invalid_attrs = { user_number: 'invalid' }
182
182
  end
183
183
 
184
- describe "When logged in as Administrator" do
184
+ describe 'When logged in as Administrator' do
185
185
  login_fixture_admin
186
186
 
187
- describe "with valid params" do
188
- it "assigns a newly created basket as @basket" do
189
- post :create, :basket => {:user_number => users(:user1).profile.user_number }
187
+ describe 'with valid params' do
188
+ it 'assigns a newly created basket as @basket' do
189
+ post :create, basket: { user_number: users(:user1).profile.user_number }
190
190
  assigns(:basket).should be_valid
191
191
  end
192
192
  end
193
193
 
194
- describe "with blank params" do
195
- it "assigns a newly created basket as @basket" do
196
- post :create, :basket => { note: 'test' }
194
+ describe 'with blank params' do
195
+ it 'assigns a newly created basket as @basket' do
196
+ post :create, basket: { note: 'test' }
197
197
  assigns(:basket).should_not be_valid
198
198
  end
199
199
  end
200
200
 
201
- describe "with invalid params" do
202
- it "assigns a newly created basket as @basket" do
203
- post :create, :basket => @invalid_attrs
201
+ describe 'with invalid params' do
202
+ it 'assigns a newly created basket as @basket' do
203
+ post :create, basket: @invalid_attrs
204
204
  assigns(:basket).should_not be_valid
205
205
  end
206
206
  end
207
207
  end
208
208
 
209
- describe "When logged in as Librarian" do
209
+ describe 'When logged in as Librarian' do
210
210
  login_fixture_librarian
211
211
 
212
- describe "with valid params" do
213
- it "assigns a newly created basket as @basket" do
214
- post :create, :basket => {:user_number => users(:user1).profile.user_number }
212
+ describe 'with valid params' do
213
+ it 'assigns a newly created basket as @basket' do
214
+ post :create, basket: { user_number: users(:user1).profile.user_number }
215
215
  assigns(:basket).should be_valid
216
216
  end
217
217
  end
218
218
 
219
- describe "with blank params" do
220
- it "assigns a newly created basket as @basket" do
221
- post :create, :basket => { note: 'test' }
219
+ describe 'with blank params' do
220
+ it 'assigns a newly created basket as @basket' do
221
+ post :create, basket: { note: 'test' }
222
222
  assigns(:basket).should_not be_valid
223
223
  end
224
224
  end
225
225
 
226
- describe "with invalid params" do
227
- it "assigns a newly created basket as @basket" do
228
- post :create, :basket => @invalid_attrs
226
+ describe 'with invalid params' do
227
+ it 'assigns a newly created basket as @basket' do
228
+ post :create, basket: @invalid_attrs
229
229
  assigns(:basket).should_not be_valid
230
230
  end
231
231
  end
232
232
 
233
- it "should not create basket when user is suspended" do
234
- post :create, :basket => {:user_number => users(:user4).profile.user_number }
233
+ it 'should not create basket when user is suspended' do
234
+ post :create, basket: { user_number: users(:user4).profile.user_number }
235
235
  assigns(:basket).should_not be_valid
236
- assigns(:basket).errors["base"].include?(I18n.t('basket.this_account_is_suspended')).should be_truthy
236
+ assigns(:basket).errors['base'].include?(I18n.t('basket.this_account_is_suspended')).should be_truthy
237
237
  response.should be_success
238
238
  end
239
239
 
240
- it "should not create basket when user is not found" do
241
- post :create, :basket => {:user_number => 'not found' }
240
+ it 'should not create basket when user is not found' do
241
+ post :create, basket: { user_number: 'not found' }
242
242
  assigns(:basket).should_not be_valid
243
- assigns(:basket).errors["base"].include?(I18n.t('user.not_found')).should be_truthy
243
+ assigns(:basket).errors['base'].include?(I18n.t('user.not_found')).should be_truthy
244
244
  response.should be_success
245
245
  end
246
246
 
247
- it "should not create basket without user_number" do
248
- post :create, :basket => { note: 'test' }
247
+ it 'should not create basket without user_number' do
248
+ post :create, basket: { note: 'test' }
249
249
  assigns(:basket).should_not be_valid
250
250
  response.should be_success
251
251
  end
252
252
 
253
- it "should create basket" do
254
- post :create, :basket => {:user_number => users(:user1).profile.user_number }
253
+ it 'should create basket' do
254
+ post :create, basket: { user_number: users(:user1).profile.user_number }
255
255
  assigns(:basket).should be_valid
256
256
  response.should redirect_to new_checked_item_url(basket_id: assigns(:basket).id)
257
257
  end
258
258
 
259
- it "should not create basket without user_number" do
260
- post :create, :basket => { note: 'test' }
259
+ it 'should not create basket without user_number' do
260
+ post :create, basket: { note: 'test' }
261
261
  assigns(:basket).should_not be_valid
262
262
  response.should be_success
263
263
  end
264
264
  end
265
265
 
266
- describe "When logged in as User" do
266
+ describe 'When logged in as User' do
267
267
  login_fixture_user
268
268
 
269
- describe "with valid params" do
270
- it "assigns a newly created basket as @basket" do
271
- post :create, :basket => {:user_number => users(:user1).profile.user_number }
269
+ describe 'with valid params' do
270
+ it 'assigns a newly created basket as @basket' do
271
+ post :create, basket: { user_number: users(:user1).profile.user_number }
272
272
  assigns(:basket).should be_nil
273
273
  end
274
274
 
275
- it "should be forbidden" do
276
- post :create, :basket => {:user_number => users(:user1).profile.user_number }
275
+ it 'should be forbidden' do
276
+ post :create, basket: { user_number: users(:user1).profile.user_number }
277
277
  response.should be_forbidden
278
278
  end
279
279
  end
280
280
 
281
- it "should not create basket" do
282
- post :create, :basket => {:user_number => users(:user1).profile.user_number }
281
+ it 'should not create basket' do
282
+ post :create, basket: { user_number: users(:user1).profile.user_number }
283
283
  response.should be_forbidden
284
284
  end
285
285
  end
286
286
 
287
- describe "When not logged in" do
288
- describe "with blank params" do
289
- it "assigns a newly created basket as @basket" do
290
- post :create, :basket => { note: 'test' }
287
+ describe 'When not logged in' do
288
+ describe 'with blank params' do
289
+ it 'assigns a newly created basket as @basket' do
290
+ post :create, basket: { note: 'test' }
291
291
  assigns(:basket).should be_nil
292
292
  end
293
293
 
294
- it "should be redirected to new_user_session_url" do
295
- post :create, :basket => { note: 'test' }
294
+ it 'should be redirected to new_user_session_url' do
295
+ post :create, basket: { note: 'test' }
296
296
  assigns(:basket).should be_nil
297
297
  assert_response :redirect
298
298
  response.should redirect_to new_user_session_url
@@ -301,21 +301,21 @@ describe BasketsController do
301
301
  end
302
302
  end
303
303
 
304
- describe "PUT update" do
304
+ describe 'PUT update' do
305
305
  before(:each) do
306
- @attrs = {:user_id => users(:user1).username}
306
+ @attrs = { user_id: users(:user1).username }
307
307
  end
308
308
 
309
- describe "When logged in as Librarian" do
309
+ describe 'When logged in as Librarian' do
310
310
  login_fixture_librarian
311
311
 
312
- describe "with valid params" do
313
- it "updates the requested basket" do
314
- put :update, :id => 8, :basket => @attrs
312
+ describe 'with valid params' do
313
+ it 'updates the requested basket' do
314
+ put :update, id: 8, basket: @attrs
315
315
  end
316
316
 
317
- it "assigns the requested basket as @basket" do
318
- put :update, :id => 8, :basket => @attrs
317
+ it 'assigns the requested basket as @basket' do
318
+ put :update, id: 8, basket: @attrs
319
319
  assigns(:basket).checkouts.order('created_at DESC').first.item.circulation_status.name.should eq 'On Loan'
320
320
  response.should redirect_to(checkouts_url(user_id: assigns(:basket).user.username))
321
321
  end
@@ -323,55 +323,55 @@ describe BasketsController do
323
323
  end
324
324
  end
325
325
 
326
- describe "DELETE destroy" do
326
+ describe 'DELETE destroy' do
327
327
  before(:each) do
328
328
  @basket = FactoryGirl.create(:basket)
329
329
  end
330
330
 
331
- describe "When logged in as Administrator" do
331
+ describe 'When logged in as Administrator' do
332
332
  login_fixture_admin
333
333
 
334
- it "should destroy basket without user_id" do
335
- delete :destroy, :id => 1, :basket => {:user_id => nil}, :user_id => users(:user1).username
334
+ it 'should destroy basket without user_id' do
335
+ delete :destroy, id: 1, basket: { user_id: nil }, user_id: users(:user1).username
336
336
  response.should redirect_to(checkouts_url(user_id: assigns(:basket).user.username))
337
337
  end
338
338
 
339
- it "should destroy basket" do
340
- delete :destroy, :id => 1, :basket => { }, :user_id => users(:user1).username
339
+ it 'should destroy basket' do
340
+ delete :destroy, id: 1, basket: {}, user_id: users(:user1).username
341
341
  response.should redirect_to(checkouts_url(user_id: assigns(:basket).user.username))
342
342
  end
343
343
  end
344
344
 
345
- describe "When logged in as Librarian" do
345
+ describe 'When logged in as Librarian' do
346
346
  login_fixture_librarian
347
347
 
348
- it "should destroy basket without user_id" do
349
- delete :destroy, :id => 1, :basket => {:user_id => nil}, :user_id => users(:user1).username
348
+ it 'should destroy basket without user_id' do
349
+ delete :destroy, id: 1, basket: { user_id: nil }, user_id: users(:user1).username
350
350
  response.should redirect_to(checkouts_url(user_id: assigns(:basket).user.username))
351
351
  end
352
352
 
353
- it "should destroy basket" do
354
- delete :destroy, :id => 1, :basket => { }, :user_id => users(:user1).username
353
+ it 'should destroy basket' do
354
+ delete :destroy, id: 1, basket: {}, user_id: users(:user1).username
355
355
  response.should redirect_to(checkouts_url(user_id: assigns(:basket).user.username))
356
356
  end
357
357
  end
358
358
 
359
- describe "When logged in as User" do
359
+ describe 'When logged in as User' do
360
360
  login_fixture_user
361
361
 
362
- it "should not destroy basket" do
363
- delete :destroy, :id => 3, :user_id => users(:user1).username
362
+ it 'should not destroy basket' do
363
+ delete :destroy, id: 3, user_id: users(:user1).username
364
364
  response.should be_forbidden
365
365
  end
366
366
  end
367
-
368
- describe "When not logged in" do
369
- it "destroys the requested basket" do
370
- delete :destroy, :id => @basket.id
367
+
368
+ describe 'When not logged in' do
369
+ it 'destroys the requested basket' do
370
+ delete :destroy, id: @basket.id
371
371
  end
372
372
 
373
- it "should be forbidden" do
374
- delete :destroy, :id => @basket.id
373
+ it 'should be forbidden' do
374
+ delete :destroy, id: @basket.id
375
375
  response.should redirect_to new_user_session_url
376
376
  end
377
377
  end