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