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,7 +3,7 @@ require 'rails_helper'
|
|
3
3
|
describe CheckoutsController do
|
4
4
|
fixtures :all
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe 'GET index', solr: true do
|
7
7
|
before do
|
8
8
|
Checkout.reindex
|
9
9
|
end
|
@@ -12,10 +12,10 @@ describe CheckoutsController do
|
|
12
12
|
FactoryGirl.create(:profile)
|
13
13
|
end
|
14
14
|
|
15
|
-
describe
|
15
|
+
describe 'When logged in as Administrator' do
|
16
16
|
login_fixture_admin
|
17
17
|
|
18
|
-
it
|
18
|
+
it 'assigns all checkouts as @checkouts' do
|
19
19
|
get :index
|
20
20
|
assigns(:checkouts).should eq Checkout.order('checkouts.created_at DESC').page(1)
|
21
21
|
assigns(:checkouts).total_entries.should eq Checkout.count
|
@@ -28,39 +28,39 @@ describe CheckoutsController do
|
|
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 'should get index' do
|
35
35
|
get :index
|
36
36
|
response.should be_success
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
39
|
+
it 'should get index txt' do
|
40
40
|
get :index, format: 'txt'
|
41
41
|
assigns(:checkouts).count.should eq assigns(:checkouts).total_entries
|
42
42
|
response.should be_success
|
43
43
|
end
|
44
44
|
|
45
|
-
it
|
45
|
+
it 'should get index rss' do
|
46
46
|
get :index, format: 'rss'
|
47
47
|
assigns(:checkouts).count.should eq assigns(:checkouts).total_entries
|
48
48
|
response.should be_success
|
49
49
|
end
|
50
50
|
|
51
|
-
it
|
51
|
+
it 'should get overdue index' do
|
52
52
|
get :index, days_overdue: 1
|
53
53
|
assigns(:checkouts).should eq Checkout.overdue(1.day.ago.beginning_of_day).order('checkouts.id DESC').page(1)
|
54
54
|
response.should be_success
|
55
55
|
end
|
56
56
|
|
57
|
-
it
|
57
|
+
it 'should get overdue index with number of days_overdue' do
|
58
58
|
get :index, days_overdue: 2
|
59
59
|
response.should be_success
|
60
60
|
assigns(:checkouts).size.should > 0
|
61
61
|
end
|
62
62
|
|
63
|
-
it
|
63
|
+
it 'should get overdue index with invalid number of days_overdue' do
|
64
64
|
get :index, days_overdue: 'invalid days'
|
65
65
|
response.should be_success
|
66
66
|
assigns(:checkouts).size.should > 0
|
@@ -72,17 +72,17 @@ describe CheckoutsController do
|
|
72
72
|
assigns(:checkouts).should eq users(:admin).checkouts.not_returned.order('checkouts.id DESC').page(1)
|
73
73
|
end
|
74
74
|
|
75
|
-
it
|
75
|
+
it 'should get index with item_id' do
|
76
76
|
get :index, item_id: 1
|
77
77
|
response.should be_success
|
78
78
|
assigns(:checkouts).should eq items(:item_00001).checkouts.order('checkouts.id DESC').page(1)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
describe
|
82
|
+
describe 'When logged in as User' do
|
83
83
|
login_fixture_user
|
84
84
|
|
85
|
-
it
|
85
|
+
it 'assigns all checkouts as @checkouts' do
|
86
86
|
get :index
|
87
87
|
assigns(:checkouts).should eq(users(:user1).checkouts.order('checkouts.created_at DESC').page(1))
|
88
88
|
assigns(:checkouts).total_entries.should eq users(:user1).checkouts.count
|
@@ -96,25 +96,25 @@ describe CheckoutsController do
|
|
96
96
|
response.should be_forbidden
|
97
97
|
end
|
98
98
|
|
99
|
-
it
|
99
|
+
it 'should get my index feed' do
|
100
100
|
get :index, format: 'rss'
|
101
101
|
response.should be_success
|
102
102
|
assigns(:checkouts).should eq(users(:user1).checkouts.order('checkouts.created_at DESC').page(1))
|
103
103
|
end
|
104
104
|
|
105
|
-
it
|
105
|
+
it 'should get my index with user_id' do
|
106
106
|
get :index, user_id: users(:user1).username
|
107
107
|
assigns(:checkouts).should be_nil
|
108
108
|
response.should redirect_to checkouts_url
|
109
109
|
end
|
110
110
|
|
111
|
-
it
|
111
|
+
it 'should get my index in txt format' do
|
112
112
|
get :index, user_id: users(:user1).username, format: 'txt'
|
113
113
|
response.should redirect_to checkouts_url(format: :txt)
|
114
114
|
assigns(:checkouts).should be_nil
|
115
115
|
end
|
116
116
|
|
117
|
-
it
|
117
|
+
it 'should get my index in rss format' do
|
118
118
|
get :index, user_id: users(:user1).username, format: 'rss'
|
119
119
|
response.should redirect_to checkouts_url(format: :rss)
|
120
120
|
assigns(:checkouts).should be_nil
|
@@ -126,23 +126,23 @@ describe CheckoutsController do
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
describe
|
130
|
-
it
|
129
|
+
describe 'When not logged in' do
|
130
|
+
it 'assigns nil as @checkouts' do
|
131
131
|
get :index
|
132
132
|
assigns(:checkouts).should be_nil
|
133
133
|
response.should redirect_to(new_user_session_url)
|
134
134
|
end
|
135
135
|
|
136
|
-
it
|
137
|
-
token =
|
136
|
+
it 'assigns his own checkouts as @checkouts' do
|
137
|
+
token = '577830b08ecf9c4c4333d599a57a6f44a7fe76c0'
|
138
138
|
user = Profile.where(checkout_icalendar_token: token).first.user
|
139
139
|
get :index, icalendar_token: token
|
140
140
|
assigns(:checkouts).should eq user.checkouts.not_returned.order('checkouts.id DESC')
|
141
141
|
response.should be_success
|
142
142
|
end
|
143
143
|
|
144
|
-
it
|
145
|
-
token =
|
144
|
+
it 'should get ics template' do
|
145
|
+
token = '577830b08ecf9c4c4333d599a57a6f44a7fe76c0'
|
146
146
|
user = Profile.where(checkout_icalendar_token: token).first.user
|
147
147
|
get :index, icalendar_token: token, format: :ics
|
148
148
|
assigns(:checkouts).should eq user.checkouts.not_returned.order('checkouts.id DESC')
|
@@ -151,8 +151,8 @@ describe CheckoutsController do
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
|
-
describe
|
155
|
-
describe
|
154
|
+
describe 'GET show' do
|
155
|
+
describe 'When logged in as Administrator' do
|
156
156
|
login_fixture_admin
|
157
157
|
|
158
158
|
it "should show other user's content" do
|
@@ -161,7 +161,7 @@ describe CheckoutsController do
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
-
describe
|
164
|
+
describe 'When logged in as Librarian' do
|
165
165
|
login_fixture_librarian
|
166
166
|
|
167
167
|
it "should show other user's content" do
|
@@ -170,10 +170,10 @@ describe CheckoutsController do
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
|
-
describe
|
173
|
+
describe 'When logged in as User' do
|
174
174
|
login_fixture_user
|
175
175
|
|
176
|
-
it
|
176
|
+
it 'should show my account' do
|
177
177
|
get :show, id: 3
|
178
178
|
response.should be_success
|
179
179
|
assigns(:checkout).should eq checkouts(:checkout_00003)
|
@@ -186,16 +186,16 @@ describe CheckoutsController do
|
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
|
-
describe
|
190
|
-
it
|
189
|
+
describe 'When not logged in' do
|
190
|
+
it 'should not assign the requested checkout as @checkout' do
|
191
191
|
get :show, id: 1
|
192
192
|
response.should redirect_to new_user_session_url
|
193
193
|
end
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
|
-
describe
|
198
|
-
describe
|
197
|
+
describe 'GET edit' do
|
198
|
+
describe 'When logged in as Administrator' do
|
199
199
|
login_fixture_admin
|
200
200
|
|
201
201
|
it "should edit other user's checkout" do
|
@@ -204,7 +204,7 @@ describe CheckoutsController do
|
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
|
-
describe
|
207
|
+
describe 'When logged in as Librarian' do
|
208
208
|
login_fixture_librarian
|
209
209
|
|
210
210
|
it "should edit other user's checkout" do
|
@@ -213,45 +213,45 @@ describe CheckoutsController do
|
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
|
-
describe
|
216
|
+
describe 'When logged in as User' do
|
217
217
|
login_fixture_user
|
218
218
|
|
219
|
-
it
|
219
|
+
it 'should edit my checkout' do
|
220
220
|
sign_in users(:user1)
|
221
221
|
get :edit, id: 3
|
222
222
|
response.should be_success
|
223
223
|
end
|
224
|
-
|
224
|
+
|
225
225
|
it "should not edit other user's checkout" do
|
226
226
|
get :edit, id: 1
|
227
227
|
response.should be_forbidden
|
228
228
|
end
|
229
229
|
end
|
230
230
|
|
231
|
-
describe
|
232
|
-
it
|
231
|
+
describe 'When not logged in' do
|
232
|
+
it 'should not edit checkout' do
|
233
233
|
get :edit, id: 1
|
234
234
|
response.should redirect_to new_user_session_url
|
235
235
|
end
|
236
236
|
end
|
237
237
|
end
|
238
238
|
|
239
|
-
describe
|
239
|
+
describe 'PUT update' do
|
240
240
|
before(:each) do
|
241
241
|
@checkout = checkouts(:checkout_00003)
|
242
|
-
@attrs = {due_date: 1.day.from_now}
|
243
|
-
@invalid_attrs = {item_identifier: 'invalid'}
|
242
|
+
@attrs = { due_date: 1.day.from_now }
|
243
|
+
@invalid_attrs = { item_identifier: 'invalid' }
|
244
244
|
end
|
245
245
|
|
246
|
-
describe
|
246
|
+
describe 'When logged in as Administrator' do
|
247
247
|
login_fixture_admin
|
248
248
|
|
249
|
-
describe
|
250
|
-
it
|
249
|
+
describe 'with valid params' do
|
250
|
+
it 'updates the requested checkout' do
|
251
251
|
put :update, id: @checkout.id, checkout: @attrs
|
252
252
|
end
|
253
253
|
|
254
|
-
it
|
254
|
+
it 'assigns the requested checkout as @checkout' do
|
255
255
|
old_due_date = @checkout.due_date
|
256
256
|
put :update, id: @checkout.id, checkout: @attrs
|
257
257
|
assigns(:checkout).should eq(@checkout)
|
@@ -260,155 +260,155 @@ describe CheckoutsController do
|
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
263
|
-
describe
|
264
|
-
it
|
263
|
+
describe 'with invalid params' do
|
264
|
+
it 'assigns the requested checkout as @checkout' do
|
265
265
|
put :update, id: @checkout.id, checkout: @invalid_attrs
|
266
266
|
end
|
267
267
|
|
268
|
-
it
|
268
|
+
it 'should ignore item_id' do
|
269
269
|
put :update, id: @checkout.id, checkout: @invalid_attrs
|
270
270
|
response.should redirect_to(assigns(:checkout))
|
271
271
|
assigns(:checkout).changed?.should be_falsy
|
272
272
|
end
|
273
273
|
end
|
274
274
|
|
275
|
-
it
|
275
|
+
it 'should remove its own checkout history' do
|
276
276
|
put :remove_all, user_id: users(:user1).username
|
277
277
|
users(:user1).checkouts.returned.count.should eq 0
|
278
278
|
response.should redirect_to checkouts_url
|
279
279
|
end
|
280
280
|
|
281
|
-
it
|
281
|
+
it 'should not remove other checkout history' do
|
282
282
|
put :remove_all, user_id: users(:user2).username
|
283
283
|
users(:user1).checkouts.returned.count.should_not eq 0
|
284
284
|
response.should redirect_to checkouts_url
|
285
285
|
end
|
286
286
|
end
|
287
287
|
|
288
|
-
describe
|
288
|
+
describe 'When logged in as Librarian' do
|
289
289
|
login_fixture_librarian
|
290
290
|
|
291
|
-
describe
|
292
|
-
it
|
291
|
+
describe 'with valid params' do
|
292
|
+
it 'updates the requested checkout' do
|
293
293
|
put :update, id: @checkout.id, checkout: @attrs, user_id: @checkout.user.username
|
294
294
|
end
|
295
295
|
|
296
|
-
it
|
296
|
+
it 'assigns the requested checkout as @checkout' do
|
297
297
|
put :update, id: @checkout.id, checkout: @attrs, user_id: @checkout.user.username
|
298
298
|
assigns(:checkout).should eq(@checkout)
|
299
299
|
response.should redirect_to(assigns(:checkout))
|
300
300
|
end
|
301
301
|
end
|
302
302
|
|
303
|
-
describe
|
304
|
-
it
|
303
|
+
describe 'with invalid params' do
|
304
|
+
it 'assigns the checkout as @checkout' do
|
305
305
|
put :update, id: @checkout.id, checkout: @invalid_attrs, user_id: @checkout.user.username
|
306
306
|
assigns(:checkout).should be_valid
|
307
307
|
end
|
308
308
|
|
309
|
-
it
|
309
|
+
it 'should ignore item_id' do
|
310
310
|
put :update, id: @checkout.id, checkout: @invalid_attrs, user_id: @checkout.user.username
|
311
311
|
response.should redirect_to(assigns(:checkout))
|
312
312
|
end
|
313
313
|
end
|
314
|
-
|
315
|
-
it
|
316
|
-
put :update, id: 8, checkout: {
|
314
|
+
|
315
|
+
it 'should update checkout item that is reserved' do
|
316
|
+
put :update, id: 8, checkout: {}
|
317
317
|
assigns(:checkout).errors[:base].include?(I18n.t('checkout.this_item_is_reserved')).should be_truthy
|
318
318
|
response.should be_success
|
319
319
|
end
|
320
|
-
|
320
|
+
|
321
321
|
it "should update other user's checkout" do
|
322
|
-
put :update, id: 1, checkout: {
|
322
|
+
put :update, id: 1, checkout: {}
|
323
323
|
response.should redirect_to checkout_url(assigns(:checkout))
|
324
324
|
end
|
325
325
|
|
326
|
-
it
|
326
|
+
it 'should remove its own checkout history' do
|
327
327
|
put :remove_all, user_id: users(:user1).username
|
328
328
|
users(:user1).checkouts.returned.count.should eq 0
|
329
329
|
response.should redirect_to checkouts_url
|
330
330
|
end
|
331
331
|
|
332
|
-
it
|
332
|
+
it 'should not remove other checkout history' do
|
333
333
|
put :remove_all, user_id: users(:user2).username
|
334
334
|
users(:user1).checkouts.returned.count.should_not eq 0
|
335
335
|
response.should redirect_to checkouts_url
|
336
336
|
end
|
337
337
|
end
|
338
338
|
|
339
|
-
describe
|
339
|
+
describe 'When logged in as User' do
|
340
340
|
login_fixture_user
|
341
341
|
|
342
|
-
describe
|
343
|
-
it
|
342
|
+
describe 'with valid params' do
|
343
|
+
it 'updates the requested checkout' do
|
344
344
|
put :update, id: checkouts(:checkout_00001).id, checkout: @attrs
|
345
345
|
end
|
346
346
|
|
347
|
-
it
|
347
|
+
it 'assigns the requested checkout as @checkout' do
|
348
348
|
put :update, id: checkouts(:checkout_00001).id, checkout: @attrs
|
349
349
|
assigns(:checkout).should eq(checkouts(:checkout_00001))
|
350
350
|
response.should be_forbidden
|
351
351
|
end
|
352
352
|
end
|
353
353
|
|
354
|
-
describe
|
355
|
-
it
|
354
|
+
describe 'with invalid params' do
|
355
|
+
it 'assigns the requested checkout as @checkout' do
|
356
356
|
put :update, id: checkouts(:checkout_00001).id, checkout: @attrs
|
357
357
|
response.should be_forbidden
|
358
358
|
end
|
359
359
|
end
|
360
360
|
|
361
361
|
it "should not update other user's checkout" do
|
362
|
-
put :update, id: 1, checkout: {
|
362
|
+
put :update, id: 1, checkout: {}
|
363
363
|
response.should be_forbidden
|
364
364
|
end
|
365
|
-
|
366
|
-
it
|
367
|
-
put :update, id: 9, checkout: {
|
365
|
+
|
366
|
+
it 'should not update checkout already renewed' do
|
367
|
+
put :update, id: 9, checkout: {}
|
368
368
|
assigns(:checkout).errors[:base].include?(I18n.t('checkout.excessed_renewal_limit')).should be_truthy
|
369
369
|
response.should be_success
|
370
370
|
end
|
371
371
|
|
372
|
-
it
|
373
|
-
put :update, id: 3, checkout: {
|
372
|
+
it 'should update my checkout' do
|
373
|
+
put :update, id: 3, checkout: {}
|
374
374
|
assigns(:checkout).should be_valid
|
375
375
|
response.should redirect_to checkout_url(assigns(:checkout))
|
376
376
|
end
|
377
|
-
|
378
|
-
it
|
379
|
-
put :update, id: 3, checkout: {item_id: nil}
|
377
|
+
|
378
|
+
it 'should not update checkout without item_id' do
|
379
|
+
put :update, id: 3, checkout: { item_id: nil }
|
380
380
|
assigns(:checkout).should be_valid
|
381
381
|
response.should redirect_to(assigns(:checkout))
|
382
382
|
assigns(:checkout).changed?.should be_falsy
|
383
383
|
end
|
384
384
|
|
385
|
-
it
|
385
|
+
it 'should remove its own checkout history' do
|
386
386
|
put :remove_all, user_id: users(:user1).username
|
387
387
|
assigns(:user).checkouts.returned.count.should eq 0
|
388
388
|
response.should redirect_to checkouts_url
|
389
389
|
end
|
390
390
|
|
391
|
-
it
|
391
|
+
it 'should not remove other checkout history' do
|
392
392
|
put :remove_all, user_id: users(:admin).username
|
393
393
|
assigns(:user).checkouts.returned.count.should eq 0
|
394
394
|
response.should be_forbidden
|
395
395
|
end
|
396
396
|
end
|
397
397
|
|
398
|
-
describe
|
399
|
-
describe
|
400
|
-
it
|
398
|
+
describe 'When not logged in' do
|
399
|
+
describe 'with valid params' do
|
400
|
+
it 'updates the requested checkout' do
|
401
401
|
put :update, id: @checkout.id, checkout: @attrs, user_id: @checkout.user.username
|
402
402
|
end
|
403
403
|
|
404
|
-
it
|
404
|
+
it 'should be forbidden' do
|
405
405
|
put :update, id: @checkout.id, checkout: @attrs, user_id: @checkout.user.username
|
406
406
|
response.should redirect_to(new_user_session_url)
|
407
407
|
end
|
408
408
|
end
|
409
409
|
|
410
|
-
describe
|
411
|
-
it
|
410
|
+
describe 'with invalid params' do
|
411
|
+
it 'assigns the requested checkout as @checkout' do
|
412
412
|
put :update, id: @checkout.id, checkout: @invalid_attrs, user_id: @checkout.user.username
|
413
413
|
response.should redirect_to(new_user_session_url)
|
414
414
|
end
|
@@ -416,72 +416,72 @@ describe CheckoutsController do
|
|
416
416
|
end
|
417
417
|
end
|
418
418
|
|
419
|
-
describe
|
419
|
+
describe 'DELETE destroy' do
|
420
420
|
before(:each) do
|
421
421
|
@checkout = checkouts(:checkout_00003)
|
422
422
|
@returned_checkout = checkouts(:checkout_00012)
|
423
423
|
end
|
424
424
|
|
425
|
-
describe
|
425
|
+
describe 'When logged in as Administrator' do
|
426
426
|
login_fixture_admin
|
427
427
|
|
428
|
-
it
|
428
|
+
it 'destroys the requested checkout' do
|
429
429
|
delete :destroy, id: @checkout.id
|
430
430
|
end
|
431
431
|
|
432
|
-
it
|
432
|
+
it 'should not destroy the checkout that is not checked in' do
|
433
433
|
delete :destroy, id: @checkout.id
|
434
434
|
response.should be_forbidden
|
435
435
|
end
|
436
436
|
|
437
|
-
it
|
437
|
+
it 'redirects to the checkouts list' do
|
438
438
|
delete :destroy, id: @returned_checkout.id
|
439
439
|
response.should redirect_to(checkouts_url(user_id: @returned_checkout.user.username))
|
440
440
|
end
|
441
441
|
end
|
442
442
|
|
443
|
-
describe
|
443
|
+
describe 'When logged in as Librarian' do
|
444
444
|
login_fixture_librarian
|
445
445
|
|
446
|
-
it
|
446
|
+
it 'destroys the requested checkout' do
|
447
447
|
delete :destroy, id: @checkout.id
|
448
448
|
end
|
449
449
|
|
450
|
-
it
|
450
|
+
it 'should not destroy the checkout that is not checked in' do
|
451
451
|
delete :destroy, id: @checkout.id
|
452
452
|
response.should be_forbidden
|
453
453
|
end
|
454
454
|
|
455
|
-
it
|
455
|
+
it 'redirects to the checkouts list' do
|
456
456
|
delete :destroy, id: @returned_checkout.id
|
457
457
|
response.should redirect_to(checkouts_url(user_id: @returned_checkout.user.username))
|
458
458
|
end
|
459
459
|
end
|
460
460
|
|
461
|
-
describe
|
461
|
+
describe 'When logged in as User' do
|
462
462
|
login_fixture_user
|
463
463
|
|
464
|
-
it
|
464
|
+
it 'destroys the requested checkout' do
|
465
465
|
delete :destroy, id: checkouts(:checkout_00001).id
|
466
466
|
end
|
467
467
|
|
468
|
-
it
|
468
|
+
it 'should be forbidden' do
|
469
469
|
delete :destroy, id: checkouts(:checkout_00001).id
|
470
470
|
response.should be_forbidden
|
471
471
|
end
|
472
472
|
|
473
|
-
it
|
473
|
+
it 'should destroy my checkout' do
|
474
474
|
delete :destroy, id: 13
|
475
475
|
response.should redirect_to checkouts_url(user_id: users(:user1).username)
|
476
476
|
end
|
477
477
|
end
|
478
478
|
|
479
|
-
describe
|
480
|
-
it
|
479
|
+
describe 'When not logged in' do
|
480
|
+
it 'destroys the requested checkout' do
|
481
481
|
delete :destroy, id: @checkout.id, user_id: @checkout.user.username
|
482
482
|
end
|
483
483
|
|
484
|
-
it
|
484
|
+
it 'should be forbidden' do
|
485
485
|
delete :destroy, id: @checkout.id, user_id: @checkout.user.username
|
486
486
|
response.should redirect_to(new_user_session_url)
|
487
487
|
end
|