enju_circulation 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.
- checksums.yaml +4 -4
- data/app/helpers/items_helper.rb +1 -1
- data/app/models/checked_item.rb +2 -1
- data/app/views/carrier_types/_carrier_type_has_checkout_type_fields.html.erb +1 -1
- data/lib/enju_circulation/version.rb +1 -1
- data/lib/tasks/enju_circulation_tasks.rake +3 -2
- data/spec/controllers/carrier_type_has_checkout_types_controller_spec.rb +152 -152
- data/spec/controllers/checked_items_controller_spec.rb +135 -135
- data/spec/controllers/checkins_controller_spec.rb +161 -161
- data/spec/controllers/checkout_types_controller_spec.rb +152 -152
- data/spec/controllers/checkouts_controller_spec.rb +103 -103
- data/spec/controllers/circulation_statuses_controller_spec.rb +152 -152
- data/spec/controllers/item_has_use_restrictions_controller_spec.rb +152 -152
- data/spec/controllers/lending_policies_controller_spec.rb +150 -150
- data/spec/controllers/manifestation_checkout_stats_controller_spec.rb +152 -152
- data/spec/controllers/manifestation_reserve_stats_controller_spec.rb +152 -152
- data/spec/controllers/profiles_controller_spec.rb +4 -4
- data/spec/controllers/reserves_controller_spec.rb +249 -249
- data/spec/controllers/use_restrictions_controller_spec.rb +153 -153
- data/spec/controllers/user_checkout_stats_controller_spec.rb +152 -152
- data/spec/controllers/user_group_has_checkout_types_controller_spec.rb +150 -150
- data/spec/controllers/user_reserve_stats_controller_spec.rb +152 -152
- data/spec/dummy/db/schema.rb +12 -2
- data/spec/fixtures/checked_items.yml +2 -1
- data/spec/helpers/items_helper_spec.rb +0 -1
- data/spec/models/checked_item_spec.rb +2 -1
- metadata +3 -17
@@ -3,53 +3,53 @@ require 'rails_helper'
|
|
3
3
|
describe CheckinsController do
|
4
4
|
fixtures :all
|
5
5
|
|
6
|
-
def mock_user(stubs={})
|
6
|
+
def mock_user(stubs = {})
|
7
7
|
(@mock_user ||= mock_model(Checkin).as_null_object).tap do |user|
|
8
8
|
user.stub(stubs) unless stubs.empty?
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe
|
13
|
-
describe
|
12
|
+
describe 'GET index' do
|
13
|
+
describe 'When logged in as Administrator' do
|
14
14
|
login_fixture_admin
|
15
15
|
|
16
|
-
it
|
16
|
+
it 'assigns all checkins as @checkins' do
|
17
17
|
get :index
|
18
18
|
assigns(:checkins).should eq Checkin.page(1)
|
19
19
|
response.should be_success
|
20
20
|
end
|
21
21
|
|
22
|
-
describe
|
23
|
-
it
|
24
|
-
get :index, :
|
22
|
+
describe 'When basket_id is specified' do
|
23
|
+
it 'assigns all checkins as @checkins' do
|
24
|
+
get :index, basket_id: 10
|
25
25
|
assigns(:checkins).should eq Basket.find(10).checkins.page(1)
|
26
26
|
response.should be_success
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe
|
31
|
+
describe 'When logged in as Librarian' do
|
32
32
|
login_fixture_librarian
|
33
33
|
|
34
|
-
it
|
34
|
+
it 'assigns all checkins as @checkins' do
|
35
35
|
get :index
|
36
36
|
assigns(:checkins).should eq Checkin.page(1)
|
37
37
|
response.should be_success
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
it
|
42
|
-
get :index, :
|
40
|
+
describe 'When basket_id is specified' do
|
41
|
+
it 'assigns all checkins as @checkins' do
|
42
|
+
get :index, basket_id: 9
|
43
43
|
assigns(:checkins).should eq Basket.find(9).checkins.page(1)
|
44
44
|
response.should be_success
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
describe
|
49
|
+
describe 'When logged in as User' do
|
50
50
|
login_fixture_user
|
51
51
|
|
52
|
-
it
|
52
|
+
it 'should not assign all checkins as @checkins' do
|
53
53
|
get :index
|
54
54
|
assigns(:checkins).should be_nil
|
55
55
|
response.should be_forbidden
|
@@ -57,79 +57,79 @@ describe CheckinsController do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
describe
|
61
|
-
describe
|
60
|
+
describe 'GET show' do
|
61
|
+
describe 'When logged in as Administrator' do
|
62
62
|
login_fixture_admin
|
63
63
|
|
64
|
-
it
|
64
|
+
it 'assigns the requested checkin as @checkin' do
|
65
65
|
checkin = checkins(:checkin_00001)
|
66
|
-
get :show, :
|
66
|
+
get :show, id: checkin.id
|
67
67
|
assigns(:checkin).should eq(checkin)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
describe
|
71
|
+
describe 'When logged in as Librarian' do
|
72
72
|
login_fixture_librarian
|
73
73
|
|
74
|
-
it
|
74
|
+
it 'assigns the requested checkin as @checkin' do
|
75
75
|
checkin = checkins(:checkin_00001)
|
76
|
-
get :show, :
|
76
|
+
get :show, id: checkin.id
|
77
77
|
assigns(:checkin).should eq(checkin)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
describe
|
81
|
+
describe 'When logged in as User' do
|
82
82
|
login_fixture_user
|
83
83
|
|
84
|
-
it
|
84
|
+
it 'assigns the requested checkin as @checkin' do
|
85
85
|
checkin = checkins(:checkin_00001)
|
86
|
-
get :show, :
|
86
|
+
get :show, id: checkin.id
|
87
87
|
assigns(:checkin).should eq(checkin)
|
88
88
|
response.should be_forbidden
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
describe
|
93
|
-
it
|
92
|
+
describe 'When not logged in' do
|
93
|
+
it 'assigns the requested checkin as @checkin' do
|
94
94
|
checkin = checkins(:checkin_00001)
|
95
|
-
get :show, :
|
95
|
+
get :show, id: checkin.id
|
96
96
|
assigns(:checkin).should eq(checkin)
|
97
97
|
response.should redirect_to new_user_session_url
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
describe
|
103
|
-
describe
|
102
|
+
describe 'GET new' do
|
103
|
+
describe 'When logged in as Administrator' do
|
104
104
|
login_fixture_admin
|
105
105
|
|
106
|
-
it
|
106
|
+
it 'assigns the requested checkin as @checkin' do
|
107
107
|
get :new
|
108
108
|
assigns(:checkin).should_not be_valid
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
describe
|
112
|
+
describe 'When logged in as Librarian' do
|
113
113
|
login_fixture_librarian
|
114
114
|
|
115
|
-
it
|
115
|
+
it 'assigns the requested checkin as @checkin' do
|
116
116
|
get :new
|
117
117
|
assigns(:checkin).should_not be_valid
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
describe
|
121
|
+
describe 'When logged in as User' do
|
122
122
|
login_fixture_user
|
123
123
|
|
124
|
-
it
|
124
|
+
it 'should not assign the requested checkin as @checkin' do
|
125
125
|
get :new
|
126
126
|
assigns(:checkin).should be_nil
|
127
127
|
response.should be_forbidden
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
describe
|
132
|
-
it
|
131
|
+
describe 'When not logged in' do
|
132
|
+
it 'should not assign the requested checkin as @checkin' do
|
133
133
|
get :new
|
134
134
|
assigns(:checkin).should be_nil
|
135
135
|
response.should redirect_to(new_user_session_url)
|
@@ -137,75 +137,75 @@ describe CheckinsController do
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
describe
|
141
|
-
describe
|
140
|
+
describe 'GET edit' do
|
141
|
+
describe 'When logged in as Administrator' do
|
142
142
|
login_fixture_admin
|
143
143
|
|
144
|
-
it
|
144
|
+
it 'assigns the requested checkin as @checkin' do
|
145
145
|
checkin = checkins(:checkin_00001)
|
146
|
-
get :edit, :
|
146
|
+
get :edit, id: checkin.id
|
147
147
|
assigns(:checkin).should eq(checkin)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
-
describe
|
151
|
+
describe 'When logged in as Librarian' do
|
152
152
|
login_fixture_librarian
|
153
153
|
|
154
|
-
it
|
154
|
+
it 'assigns the requested checkin as @checkin' do
|
155
155
|
checkin = checkins(:checkin_00001)
|
156
|
-
get :edit, :
|
156
|
+
get :edit, id: checkin.id
|
157
157
|
assigns(:checkin).should eq(checkin)
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
-
describe
|
161
|
+
describe 'When logged in as User' do
|
162
162
|
login_fixture_user
|
163
163
|
|
164
|
-
it
|
164
|
+
it 'assigns the requested checkin as @checkin' do
|
165
165
|
checkin = checkins(:checkin_00001)
|
166
|
-
get :edit, :
|
166
|
+
get :edit, id: checkin.id
|
167
167
|
response.should be_forbidden
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
|
-
describe
|
172
|
-
it
|
171
|
+
describe 'When not logged in' do
|
172
|
+
it 'should not assign the requested checkin as @checkin' do
|
173
173
|
checkin = checkins(:checkin_00001)
|
174
|
-
get :edit, :
|
174
|
+
get :edit, id: checkin.id
|
175
175
|
response.should redirect_to(new_user_session_url)
|
176
176
|
end
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
180
|
-
describe
|
180
|
+
describe 'POST create' do
|
181
181
|
before(:each) do
|
182
|
-
@attrs = {:
|
183
|
-
@invalid_attrs = {:
|
182
|
+
@attrs = { item_identifier: '00003' }
|
183
|
+
@invalid_attrs = { item_identifier: 'invalid' }
|
184
184
|
end
|
185
185
|
|
186
|
-
describe
|
186
|
+
describe 'When logged in as Administrator' do
|
187
187
|
login_fixture_admin
|
188
188
|
|
189
|
-
describe
|
190
|
-
it
|
191
|
-
post :create, :
|
189
|
+
describe 'with valid params' do
|
190
|
+
it 'assigns a newly created checkin as @checkin' do
|
191
|
+
post :create, checkin: @attrs
|
192
192
|
assigns(:checkin).should be_nil
|
193
193
|
end
|
194
194
|
|
195
|
-
it
|
196
|
-
post :create, :
|
195
|
+
it 'should not create checkin without basket_id' do
|
196
|
+
post :create, checkin: @attrs
|
197
197
|
response.should be_forbidden
|
198
198
|
end
|
199
199
|
|
200
|
-
describe
|
201
|
-
it
|
202
|
-
post :create, :
|
200
|
+
describe 'When basket_id is specified' do
|
201
|
+
it 'redirects to the created checkin' do
|
202
|
+
post :create, checkin: @attrs, basket_id: 9
|
203
203
|
response.should redirect_to(checkins_url(basket_id: assigns(:checkin).basket_id))
|
204
204
|
assigns(:checkin).item.circulation_status.name.should eq 'Available On Shelf'
|
205
205
|
end
|
206
206
|
|
207
|
-
it
|
208
|
-
post :create, :
|
207
|
+
it 'should checkin the overdue item' do
|
208
|
+
post :create, checkin: { item_identifier: '00014' }, basket_id: 9
|
209
209
|
response.should redirect_to(checkins_url(basket_id: assigns(:checkin).basket_id))
|
210
210
|
assigns(:checkin).checkout.should be_valid
|
211
211
|
assigns(:checkin).item.circulation_status.name.should eq 'Available On Shelf'
|
@@ -213,49 +213,49 @@ describe CheckinsController do
|
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
|
-
describe
|
217
|
-
it
|
218
|
-
post :create, :
|
216
|
+
describe 'with invalid params' do
|
217
|
+
it 'assigns a newly created but unsaved checkin as @checkin' do
|
218
|
+
post :create, checkin: @invalid_attrs
|
219
219
|
assigns(:checkin).should be_nil
|
220
220
|
end
|
221
221
|
|
222
|
-
it
|
223
|
-
post :create, :
|
222
|
+
it 'should be forbidden' do
|
223
|
+
post :create, checkin: @invalid_attrs
|
224
224
|
response.should be_forbidden
|
225
225
|
end
|
226
226
|
end
|
227
227
|
|
228
|
-
it
|
229
|
-
post :create, :
|
228
|
+
it 'should not create checkin without item_id' do
|
229
|
+
post :create, checkin: { item_identifier: nil }, basket_id: 9
|
230
230
|
assigns(:checkin).should_not be_valid
|
231
231
|
response.should be_success
|
232
232
|
end
|
233
233
|
end
|
234
234
|
|
235
|
-
describe
|
235
|
+
describe 'When logged in as Librarian' do
|
236
236
|
login_fixture_librarian
|
237
237
|
|
238
|
-
describe
|
239
|
-
it
|
240
|
-
post :create, :
|
238
|
+
describe 'with valid params' do
|
239
|
+
it 'assigns a newly created checkin as @checkin' do
|
240
|
+
post :create, checkin: @attrs
|
241
241
|
assigns(:checkin).should be_nil
|
242
242
|
end
|
243
243
|
|
244
|
-
it
|
245
|
-
post :create, :
|
244
|
+
it 'should not create checkin without basket_id' do
|
245
|
+
post :create, checkin: @attrs
|
246
246
|
response.should be_forbidden
|
247
247
|
end
|
248
248
|
|
249
|
-
it
|
250
|
-
post :create, :
|
249
|
+
it 'should show notification when it is reserved' do
|
250
|
+
post :create, checkin: { item_identifier: '00008' }, basket_id: 9
|
251
251
|
flash[:message].to_s.index(I18n.t('item.this_item_is_reserved')).should be_truthy
|
252
252
|
assigns(:checkin).item.should be_retained
|
253
253
|
assigns(:checkin).item.circulation_status.name.should eq 'Available On Shelf'
|
254
254
|
response.should redirect_to(checkins_url(basket_id: assigns(:basket).id))
|
255
255
|
end
|
256
256
|
|
257
|
-
it
|
258
|
-
post :create, :
|
257
|
+
it 'should show notification when an item includes supplements' do
|
258
|
+
post :create, checkin: { item_identifier: '00004' }, basket_id: 9
|
259
259
|
assigns(:checkin).item.circulation_status.name.should eq 'Available On Shelf'
|
260
260
|
flash[:message].to_s.index(I18n.t('item.this_item_include_supplement')).should be_truthy
|
261
261
|
response.should redirect_to(checkins_url(basket_id: assigns(:basket).id))
|
@@ -264,211 +264,211 @@ describe CheckinsController do
|
|
264
264
|
|
265
265
|
it "should show notice when other library's item is checked in" do
|
266
266
|
sign_in users(:librarian2)
|
267
|
-
post :create, :
|
267
|
+
post :create, checkin: { item_identifier: '00009' }, basket_id: 9
|
268
268
|
assigns(:checkin).should be_valid
|
269
269
|
flash[:message].to_s.index(I18n.t('checkin.other_library_item')).should be_truthy
|
270
270
|
response.should redirect_to(checkins_url(basket_id: assigns(:basket).id))
|
271
271
|
end
|
272
272
|
end
|
273
273
|
|
274
|
-
describe
|
274
|
+
describe 'When logged in as User' do
|
275
275
|
login_fixture_user
|
276
276
|
|
277
|
-
describe
|
278
|
-
it
|
279
|
-
post :create, :
|
277
|
+
describe 'with valid params' do
|
278
|
+
it 'assigns a newly created checkin as @checkin' do
|
279
|
+
post :create, checkin: @attrs
|
280
280
|
assigns(:checkin).should be_nil
|
281
281
|
end
|
282
282
|
|
283
|
-
it
|
284
|
-
post :create, :
|
283
|
+
it 'should be forbidden' do
|
284
|
+
post :create, checkin: @attrs
|
285
285
|
response.should be_forbidden
|
286
286
|
end
|
287
287
|
end
|
288
288
|
end
|
289
289
|
|
290
|
-
describe
|
290
|
+
describe 'When not logged in' do
|
291
291
|
before(:each) do
|
292
|
-
@attrs = {:
|
293
|
-
@invalid_attrs = {:
|
292
|
+
@attrs = { item_identifier: '00003' }
|
293
|
+
@invalid_attrs = { item_identifier: 'invalid' }
|
294
294
|
end
|
295
295
|
|
296
|
-
describe
|
297
|
-
it
|
298
|
-
post :create, :
|
296
|
+
describe 'with valid params' do
|
297
|
+
it 'assigns a newly created checkin as @checkin' do
|
298
|
+
post :create, checkin: @attrs
|
299
299
|
end
|
300
300
|
|
301
|
-
it
|
302
|
-
post :create, :
|
301
|
+
it 'should redirect to new session url' do
|
302
|
+
post :create, checkin: @attrs
|
303
303
|
response.should redirect_to new_user_session_url
|
304
304
|
end
|
305
305
|
end
|
306
306
|
end
|
307
307
|
end
|
308
308
|
|
309
|
-
describe
|
309
|
+
describe 'PUT update' do
|
310
310
|
before(:each) do
|
311
311
|
@checkin = checkins(:checkin_00001)
|
312
|
-
@attrs = {:
|
313
|
-
@invalid_attrs = {:
|
312
|
+
@attrs = { item_identifier: @checkin.item.item_identifier }
|
313
|
+
@invalid_attrs = { item_identifier: 'invalid' }
|
314
314
|
end
|
315
315
|
|
316
|
-
describe
|
316
|
+
describe 'When logged in as Administrator' do
|
317
317
|
login_fixture_admin
|
318
318
|
|
319
|
-
describe
|
320
|
-
it
|
321
|
-
put :update, :
|
319
|
+
describe 'with valid params' do
|
320
|
+
it 'updates the requested checkin' do
|
321
|
+
put :update, id: @checkin.id, checkin: @attrs
|
322
322
|
end
|
323
323
|
|
324
|
-
it
|
325
|
-
put :update, :
|
324
|
+
it 'assigns the requested checkin as @checkin' do
|
325
|
+
put :update, id: @checkin.id, checkin: @attrs
|
326
326
|
assigns(:checkin).should eq(@checkin)
|
327
327
|
response.should redirect_to(@checkin)
|
328
328
|
end
|
329
329
|
end
|
330
330
|
|
331
|
-
describe
|
332
|
-
it
|
333
|
-
put :update, :
|
331
|
+
describe 'with invalid params' do
|
332
|
+
it 'assigns the requested checkin as @checkin' do
|
333
|
+
put :update, id: @checkin.id, checkin: @invalid_attrs
|
334
334
|
end
|
335
335
|
|
336
336
|
it "re-renders the 'edit' template" do
|
337
|
-
put :update, :
|
338
|
-
response.should render_template(
|
337
|
+
put :update, id: @checkin.id, checkin: @invalid_attrs
|
338
|
+
response.should render_template('edit')
|
339
339
|
end
|
340
340
|
|
341
|
-
it
|
342
|
-
put :update, :
|
341
|
+
it 'should not update checkin without item_identifier' do
|
342
|
+
put :update, id: @checkin.id, checkin: @attrs.merge(item_identifier: nil)
|
343
343
|
assigns(:checkin).should be_valid
|
344
344
|
response.should redirect_to(@checkin)
|
345
345
|
end
|
346
346
|
end
|
347
347
|
end
|
348
348
|
|
349
|
-
describe
|
349
|
+
describe 'When logged in as Librarian' do
|
350
350
|
login_fixture_librarian
|
351
351
|
|
352
|
-
describe
|
353
|
-
it
|
354
|
-
put :update, :
|
352
|
+
describe 'with valid params' do
|
353
|
+
it 'updates the requested checkin' do
|
354
|
+
put :update, id: @checkin.id, checkin: @attrs
|
355
355
|
end
|
356
356
|
|
357
|
-
it
|
358
|
-
put :update, :
|
357
|
+
it 'assigns the requested checkin as @checkin' do
|
358
|
+
put :update, id: @checkin.id, checkin: @attrs
|
359
359
|
assigns(:checkin).should eq(@checkin)
|
360
360
|
response.should redirect_to(@checkin)
|
361
361
|
end
|
362
362
|
end
|
363
363
|
|
364
|
-
describe
|
365
|
-
it
|
366
|
-
put :update, :
|
364
|
+
describe 'with invalid params' do
|
365
|
+
it 'assigns the checkin as @checkin' do
|
366
|
+
put :update, id: @checkin.id, checkin: @invalid_attrs
|
367
367
|
assigns(:checkin).should_not be_valid
|
368
368
|
end
|
369
369
|
|
370
370
|
it "re-renders the 'edit' template" do
|
371
|
-
put :update, :
|
372
|
-
response.should render_template(
|
371
|
+
put :update, id: @checkin.id, checkin: @invalid_attrs
|
372
|
+
response.should render_template('edit')
|
373
373
|
end
|
374
374
|
end
|
375
375
|
end
|
376
376
|
|
377
|
-
describe
|
377
|
+
describe 'When logged in as User' do
|
378
378
|
login_fixture_user
|
379
379
|
|
380
|
-
describe
|
381
|
-
it
|
382
|
-
put :update, :
|
380
|
+
describe 'with valid params' do
|
381
|
+
it 'updates the requested checkin' do
|
382
|
+
put :update, id: @checkin.id, checkin: @attrs
|
383
383
|
end
|
384
384
|
|
385
|
-
it
|
386
|
-
put :update, :
|
385
|
+
it 'assigns the requested checkin as @checkin' do
|
386
|
+
put :update, id: @checkin.id, checkin: @attrs
|
387
387
|
assigns(:checkin).should eq(@checkin)
|
388
388
|
response.should be_forbidden
|
389
389
|
end
|
390
390
|
end
|
391
391
|
|
392
|
-
describe
|
393
|
-
it
|
394
|
-
put :update, :
|
392
|
+
describe 'with invalid params' do
|
393
|
+
it 'assigns the requested checkin as @checkin' do
|
394
|
+
put :update, id: @checkin.id, checkin: @invalid_attrs
|
395
395
|
response.should be_forbidden
|
396
396
|
end
|
397
397
|
end
|
398
398
|
end
|
399
399
|
|
400
|
-
describe
|
401
|
-
describe
|
402
|
-
it
|
403
|
-
put :update, :
|
400
|
+
describe 'When not logged in' do
|
401
|
+
describe 'with valid params' do
|
402
|
+
it 'updates the requested checkin' do
|
403
|
+
put :update, id: @checkin.id, checkin: @attrs
|
404
404
|
end
|
405
405
|
|
406
|
-
it
|
407
|
-
put :update, :
|
406
|
+
it 'should be forbidden' do
|
407
|
+
put :update, id: @checkin.id, checkin: @attrs
|
408
408
|
response.should redirect_to(new_user_session_url)
|
409
409
|
end
|
410
410
|
end
|
411
411
|
|
412
|
-
describe
|
413
|
-
it
|
414
|
-
put :update, :
|
412
|
+
describe 'with invalid params' do
|
413
|
+
it 'assigns the requested checkin as @checkin' do
|
414
|
+
put :update, id: @checkin.id, checkin: @invalid_attrs
|
415
415
|
response.should redirect_to(new_user_session_url)
|
416
416
|
end
|
417
417
|
end
|
418
418
|
end
|
419
419
|
end
|
420
420
|
|
421
|
-
describe
|
421
|
+
describe 'DELETE destroy' do
|
422
422
|
before(:each) do
|
423
423
|
@checkin = checkins(:checkin_00001)
|
424
424
|
end
|
425
425
|
|
426
|
-
describe
|
426
|
+
describe 'When logged in as Administrator' do
|
427
427
|
login_fixture_admin
|
428
428
|
|
429
|
-
it
|
430
|
-
delete :destroy, :
|
429
|
+
it 'destroys the requested checkin' do
|
430
|
+
delete :destroy, id: @checkin.id
|
431
431
|
end
|
432
432
|
|
433
|
-
it
|
434
|
-
delete :destroy, :
|
433
|
+
it 'redirects to the checkins list' do
|
434
|
+
delete :destroy, id: @checkin.id
|
435
435
|
response.should redirect_to(checkins_url)
|
436
436
|
end
|
437
437
|
end
|
438
438
|
|
439
|
-
describe
|
439
|
+
describe 'When logged in as Librarian' do
|
440
440
|
login_fixture_librarian
|
441
441
|
|
442
|
-
it
|
443
|
-
delete :destroy, :
|
442
|
+
it 'destroys the requested checkin' do
|
443
|
+
delete :destroy, id: @checkin.id
|
444
444
|
end
|
445
445
|
|
446
|
-
it
|
447
|
-
delete :destroy, :
|
446
|
+
it 'redirects to the checkins list' do
|
447
|
+
delete :destroy, id: @checkin.id
|
448
448
|
response.should redirect_to(checkins_url)
|
449
449
|
end
|
450
450
|
end
|
451
451
|
|
452
|
-
describe
|
452
|
+
describe 'When logged in as User' do
|
453
453
|
login_fixture_user
|
454
454
|
|
455
|
-
it
|
456
|
-
delete :destroy, :
|
455
|
+
it 'destroys the requested checkin' do
|
456
|
+
delete :destroy, id: @checkin.id
|
457
457
|
end
|
458
458
|
|
459
|
-
it
|
460
|
-
delete :destroy, :
|
459
|
+
it 'should be forbidden' do
|
460
|
+
delete :destroy, id: @checkin.id
|
461
461
|
response.should be_forbidden
|
462
462
|
end
|
463
463
|
end
|
464
464
|
|
465
|
-
describe
|
466
|
-
it
|
467
|
-
delete :destroy, :
|
465
|
+
describe 'When not logged in' do
|
466
|
+
it 'destroys the requested checkin' do
|
467
|
+
delete :destroy, id: @checkin.id
|
468
468
|
end
|
469
469
|
|
470
|
-
it
|
471
|
-
delete :destroy, :
|
470
|
+
it 'should be forbidden' do
|
471
|
+
delete :destroy, id: @checkin.id
|
472
472
|
response.should redirect_to(new_user_session_url)
|
473
473
|
end
|
474
474
|
end
|