enju_circulation 0.3.0.beta.1 → 0.3.0.rc.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/lib/enju_circulation/version.rb +1 -1
- data/spec/controllers/carrier_type_has_checkout_types_controller_spec.rb +0 -441
- data/spec/controllers/checked_items_controller_spec.rb +11 -11
- data/spec/controllers/checkins_controller_spec.rb +5 -5
- data/spec/controllers/checkout_types_controller_spec.rb +2 -2
- data/spec/controllers/checkouts_controller_spec.rb +22 -22
- data/spec/controllers/item_has_use_restrictions_controller_spec.rb +1 -1
- data/spec/controllers/lending_policies_controller_spec.rb +2 -2
- data/spec/controllers/reserves_controller_spec.rb +30 -30
- data/spec/controllers/user_group_has_checkout_types_controller_spec.rb +2 -2
- metadata +338 -338
@@ -10,13 +10,13 @@ describe CheckedItemsController do
|
|
10
10
|
it 'assigns all checked_items as @checked_items' do
|
11
11
|
get :index
|
12
12
|
assigns(:checked_items).should_not be_empty
|
13
|
-
response.should
|
13
|
+
response.should be_successful
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should get index without basket_id' do
|
17
17
|
get :index, params: { item_id: 1 }
|
18
18
|
assigns(:checked_items).should_not be_empty
|
19
|
-
response.should
|
19
|
+
response.should be_successful
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -26,14 +26,14 @@ describe CheckedItemsController do
|
|
26
26
|
it 'should be forbidden' do
|
27
27
|
get :index
|
28
28
|
assigns(:checked_items).should_not be_empty
|
29
|
-
response.should
|
29
|
+
response.should be_successful
|
30
30
|
end
|
31
31
|
|
32
32
|
describe 'When basket is specified' do
|
33
33
|
it 'assigns checked_items as @checked_items' do
|
34
34
|
get :index, params: { basket_id: 1 }
|
35
35
|
assigns(:checked_items).should_not be_empty
|
36
|
-
response.should
|
36
|
+
response.should be_successful
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -75,7 +75,7 @@ describe CheckedItemsController do
|
|
75
75
|
it 'assigns the requested checked_item as @checked_item' do
|
76
76
|
get :show, params: { id: 1 }
|
77
77
|
assigns(:checked_item).should eq(checked_items(:checked_item_00001))
|
78
|
-
response.should
|
78
|
+
response.should be_successful
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -85,7 +85,7 @@ describe CheckedItemsController do
|
|
85
85
|
it 'assigns the requested checked_item as @checked_item' do
|
86
86
|
get :show, params: { id: 1 }
|
87
87
|
assigns(:checked_item).should eq(checked_items(:checked_item_00001))
|
88
|
-
response.should
|
88
|
+
response.should be_successful
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -131,7 +131,7 @@ describe CheckedItemsController do
|
|
131
131
|
it 'assigns the requested checked_item as @checked_item' do
|
132
132
|
get :new, params: { basket_id: 3 }
|
133
133
|
assigns(:checked_item).should_not be_valid
|
134
|
-
response.should
|
134
|
+
response.should be_successful
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
@@ -172,7 +172,7 @@ describe CheckedItemsController do
|
|
172
172
|
checked_item = checked_items(:checked_item_00001)
|
173
173
|
get :edit, params: { id: checked_item.id }
|
174
174
|
assigns(:checked_item).should eq(checked_item)
|
175
|
-
response.should
|
175
|
+
response.should be_successful
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
@@ -245,7 +245,7 @@ describe CheckedItemsController do
|
|
245
245
|
|
246
246
|
it 'should not create checked_item without item_id' do
|
247
247
|
post :create, params: { checked_item: { item_identifier: '00004' }, basket_id: 1 }
|
248
|
-
response.should
|
248
|
+
response.should be_successful
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
@@ -276,12 +276,12 @@ describe CheckedItemsController do
|
|
276
276
|
post :create, params: { checked_item: { item_identifier: '00011', due_date_string: 'invalid' }, basket_id: 3 }
|
277
277
|
assigns(:checked_item).should_not be_valid
|
278
278
|
assigns(:checked_item).due_date.should be_nil
|
279
|
-
response.should
|
279
|
+
response.should be_successful
|
280
280
|
end
|
281
281
|
|
282
282
|
it 'should not create checked_item if excessed checkout_limit' do
|
283
283
|
post :create, params: { checked_item: { item_identifier: '00011' }, basket_id: 1 }
|
284
|
-
response.should
|
284
|
+
response.should be_successful
|
285
285
|
assigns(:checked_item).errors['base'].include?(I18n.t('activerecord.errors.messages.checked_item.excessed_checkout_limit')).should be_truthy
|
286
286
|
end
|
287
287
|
|
@@ -16,14 +16,14 @@ describe CheckinsController do
|
|
16
16
|
it 'assigns all checkins as @checkins' do
|
17
17
|
get :index
|
18
18
|
assigns(:checkins).should eq Checkin.page(1)
|
19
|
-
response.should
|
19
|
+
response.should be_successful
|
20
20
|
end
|
21
21
|
|
22
22
|
describe 'When basket_id is specified' do
|
23
23
|
it 'assigns all checkins as @checkins' do
|
24
24
|
get :index, params: { basket_id: 10 }
|
25
25
|
assigns(:checkins).should eq Basket.find(10).checkins.page(1)
|
26
|
-
response.should
|
26
|
+
response.should be_successful
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -34,14 +34,14 @@ describe CheckinsController do
|
|
34
34
|
it 'assigns all checkins as @checkins' do
|
35
35
|
get :index
|
36
36
|
assigns(:checkins).should eq Checkin.page(1)
|
37
|
-
response.should
|
37
|
+
response.should be_successful
|
38
38
|
end
|
39
39
|
|
40
40
|
describe 'When basket_id is specified' do
|
41
41
|
it 'assigns all checkins as @checkins' do
|
42
42
|
get :index, params: { basket_id: 9 }
|
43
43
|
assigns(:checkins).should eq Basket.find(9).checkins.page(1)
|
44
|
-
response.should
|
44
|
+
response.should be_successful
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -228,7 +228,7 @@ describe CheckinsController do
|
|
228
228
|
it 'should not create checkin without item_id' do
|
229
229
|
post :create, params: { checkin: { item_identifier: nil }, basket_id: 9 }
|
230
230
|
assigns(:checkin).should_not be_valid
|
231
|
-
response.should
|
231
|
+
response.should be_successful
|
232
232
|
end
|
233
233
|
end
|
234
234
|
|
@@ -92,7 +92,7 @@ describe CheckoutTypesController do
|
|
92
92
|
it 'assigns the requested checkout_type as @checkout_type' do
|
93
93
|
get :new
|
94
94
|
assigns(:checkout_type).should_not be_valid
|
95
|
-
response.should
|
95
|
+
response.should be_successful
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -194,7 +194,7 @@ describe CheckoutTypesController do
|
|
194
194
|
|
195
195
|
it 'should be successful' do
|
196
196
|
post :create, params: { checkout_type: @invalid_attrs }
|
197
|
-
response.should
|
197
|
+
response.should be_successful
|
198
198
|
end
|
199
199
|
end
|
200
200
|
end
|
@@ -23,7 +23,7 @@ describe CheckoutsController do
|
|
23
23
|
|
24
24
|
it "should get other user's index" do
|
25
25
|
get :index, params: { user_id: users(:admin).username }
|
26
|
-
response.should
|
26
|
+
response.should be_successful
|
27
27
|
assigns(:checkouts).should eq users(:admin).checkouts.not_returned.order('checkouts.id DESC').page(1)
|
28
28
|
end
|
29
29
|
|
@@ -42,48 +42,48 @@ describe CheckoutsController do
|
|
42
42
|
|
43
43
|
it 'should get index' do
|
44
44
|
get :index
|
45
|
-
response.should
|
45
|
+
response.should be_successful
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'should get index txt' do
|
49
49
|
get :index, format: 'txt'
|
50
50
|
assigns(:checkouts).count.should eq assigns(:checkouts).total_entries
|
51
|
-
response.should
|
51
|
+
response.should be_successful
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'should get index rss' do
|
55
55
|
get :index, format: 'rss'
|
56
56
|
assigns(:checkouts).count.should eq assigns(:checkouts).total_entries
|
57
|
-
response.should
|
57
|
+
response.should be_successful
|
58
58
|
end
|
59
59
|
|
60
60
|
it 'should get overdue index' do
|
61
61
|
get :index, params: { days_overdue: 1 }
|
62
62
|
assigns(:checkouts).should eq Checkout.overdue(1.day.ago.beginning_of_day).order('checkouts.id DESC').page(1)
|
63
|
-
response.should
|
63
|
+
response.should be_successful
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'should get overdue index with number of days_overdue' do
|
67
67
|
get :index, params: { days_overdue: 2 }
|
68
|
-
response.should
|
68
|
+
response.should be_successful
|
69
69
|
assigns(:checkouts).size.should > 0
|
70
70
|
end
|
71
71
|
|
72
72
|
it 'should get overdue index with invalid number of days_overdue' do
|
73
73
|
get :index, params: { days_overdue: 'invalid days' }
|
74
|
-
response.should
|
74
|
+
response.should be_successful
|
75
75
|
assigns(:checkouts).size.should > 0
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should get other user's index" do
|
79
79
|
get :index, params: { user_id: users(:admin).username }
|
80
|
-
response.should
|
80
|
+
response.should be_successful
|
81
81
|
assigns(:checkouts).should eq users(:admin).checkouts.not_returned.order('checkouts.id DESC').page(1)
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'should get index with item_id' do
|
85
85
|
get :index, params: { item_id: 1 }
|
86
|
-
response.should
|
86
|
+
response.should be_successful
|
87
87
|
assigns(:checkouts).should eq items(:item_00001).checkouts.order('checkouts.id DESC').page(1)
|
88
88
|
end
|
89
89
|
end
|
@@ -95,7 +95,7 @@ describe CheckoutsController do
|
|
95
95
|
get :index
|
96
96
|
assigns(:checkouts).should eq(users(:user1).checkouts.order('checkouts.created_at DESC').page(1))
|
97
97
|
assigns(:checkouts).total_entries.should eq users(:user1).checkouts.count
|
98
|
-
response.should
|
98
|
+
response.should be_successful
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should be forbidden if other's username is specified" do
|
@@ -107,7 +107,7 @@ describe CheckoutsController do
|
|
107
107
|
|
108
108
|
it 'should get my index feed' do
|
109
109
|
get :index, format: 'rss'
|
110
|
-
response.should
|
110
|
+
response.should be_successful
|
111
111
|
assigns(:checkouts).should eq(users(:user1).checkouts.order('checkouts.created_at DESC').page(1))
|
112
112
|
end
|
113
113
|
|
@@ -147,7 +147,7 @@ describe CheckoutsController do
|
|
147
147
|
user = Profile.where(checkout_icalendar_token: token).first.user
|
148
148
|
get :index, params: { icalendar_token: token }
|
149
149
|
assigns(:checkouts).should eq user.checkouts.not_returned.order('checkouts.id DESC')
|
150
|
-
response.should
|
150
|
+
response.should be_successful
|
151
151
|
end
|
152
152
|
|
153
153
|
it 'should get ics template' do
|
@@ -155,7 +155,7 @@ describe CheckoutsController do
|
|
155
155
|
user = Profile.where(checkout_icalendar_token: token).first.user
|
156
156
|
get :index, params: { icalendar_token: token, format: :ics }
|
157
157
|
assigns(:checkouts).should eq user.checkouts.not_returned.order('checkouts.id DESC')
|
158
|
-
response.should
|
158
|
+
response.should be_successful
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
@@ -166,7 +166,7 @@ describe CheckoutsController do
|
|
166
166
|
|
167
167
|
it "should show other user's content" do
|
168
168
|
get :show, params: { id: 3 }
|
169
|
-
response.should
|
169
|
+
response.should be_successful
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
@@ -175,7 +175,7 @@ describe CheckoutsController do
|
|
175
175
|
|
176
176
|
it "should show other user's content" do
|
177
177
|
get :show, params: { id: 3 }
|
178
|
-
response.should
|
178
|
+
response.should be_successful
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
@@ -184,7 +184,7 @@ describe CheckoutsController do
|
|
184
184
|
|
185
185
|
it 'should show my account' do
|
186
186
|
get :show, params: { id: 3 }
|
187
|
-
response.should
|
187
|
+
response.should be_successful
|
188
188
|
assigns(:checkout).should eq checkouts(:checkout_00003)
|
189
189
|
end
|
190
190
|
|
@@ -209,7 +209,7 @@ describe CheckoutsController do
|
|
209
209
|
|
210
210
|
it "should edit other user's checkout" do
|
211
211
|
get :edit, params: { id: 3 }
|
212
|
-
response.should
|
212
|
+
response.should be_successful
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
@@ -218,7 +218,7 @@ describe CheckoutsController do
|
|
218
218
|
|
219
219
|
it "should edit other user's checkout" do
|
220
220
|
get :edit, params: { id: 3 }
|
221
|
-
response.should
|
221
|
+
response.should be_successful
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
@@ -228,7 +228,7 @@ describe CheckoutsController do
|
|
228
228
|
it 'should edit my checkout' do
|
229
229
|
sign_in users(:user1)
|
230
230
|
get :edit, params: { id: 3 }
|
231
|
-
response.should
|
231
|
+
response.should be_successful
|
232
232
|
end
|
233
233
|
|
234
234
|
it "should not edit other user's checkout" do
|
@@ -283,7 +283,7 @@ describe CheckoutsController do
|
|
283
283
|
it 'should not accept invalid date' do
|
284
284
|
put :update, params: { id: @checkout.id, checkout: @invalid_attrs.merge(due_date: '2017-03-151') }
|
285
285
|
assigns(:checkout).changed?.should be_truthy
|
286
|
-
response.should
|
286
|
+
response.should be_successful
|
287
287
|
end
|
288
288
|
end
|
289
289
|
|
@@ -330,7 +330,7 @@ describe CheckoutsController do
|
|
330
330
|
it 'should update checkout item that is reserved' do
|
331
331
|
put :update, params: { id: 8, checkout: {} }
|
332
332
|
assigns(:checkout).errors[:base].include?(I18n.t('checkout.this_item_is_reserved')).should be_truthy
|
333
|
-
response.should
|
333
|
+
response.should be_successful
|
334
334
|
end
|
335
335
|
|
336
336
|
it "should update other user's checkout" do
|
@@ -381,7 +381,7 @@ describe CheckoutsController do
|
|
381
381
|
it 'should not update checkout already renewed' do
|
382
382
|
put :update, params: { id: 9, checkout: {} }
|
383
383
|
assigns(:checkout).errors[:base].include?(I18n.t('checkout.excessed_renewal_limit')).should be_truthy
|
384
|
-
response.should
|
384
|
+
response.should be_successful
|
385
385
|
end
|
386
386
|
|
387
387
|
it 'should update my checkout' do
|
@@ -98,7 +98,7 @@ describe ItemHasUseRestrictionsController do
|
|
98
98
|
it 'assigns the requested item_has_use_restriction as @item_has_use_restriction' do
|
99
99
|
get :new
|
100
100
|
assigns(:item_has_use_restriction).should_not be_valid
|
101
|
-
response.should
|
101
|
+
response.should be_successful
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -60,7 +60,7 @@ describe LendingPoliciesController do
|
|
60
60
|
it 'assigns the requested lending_policy as @lending_policy' do
|
61
61
|
get :show, params: { id: @lending_policy.id }
|
62
62
|
assigns(:lending_policy).should eq(@lending_policy)
|
63
|
-
response.should
|
63
|
+
response.should be_successful
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -70,7 +70,7 @@ describe LendingPoliciesController do
|
|
70
70
|
it 'assigns the requested lending_policy as @lending_policy' do
|
71
71
|
get :show, params: { id: @lending_policy.id }
|
72
72
|
assigns(:lending_policy).should eq(@lending_policy)
|
73
|
-
response.should
|
73
|
+
response.should be_successful
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -18,7 +18,7 @@ describe ReservesController do
|
|
18
18
|
|
19
19
|
it "should get other user's reservation" do
|
20
20
|
get :index, params: { user_id: users(:user1).username }
|
21
|
-
response.should
|
21
|
+
response.should be_successful
|
22
22
|
assigns(:reserves).should eq(users(:user1).reserves.order('reserves.id DESC').includes(:manifestation).page(1))
|
23
23
|
end
|
24
24
|
end
|
@@ -33,39 +33,39 @@ describe ReservesController do
|
|
33
33
|
|
34
34
|
it 'should get index feed without user_id' do
|
35
35
|
get :index, format: 'rss'
|
36
|
-
response.should
|
36
|
+
response.should be_successful
|
37
37
|
assigns(:reserves).count.should eq assigns(:reserves).total_entries
|
38
38
|
assigns(:reserves).should eq(Reserve.order('reserves.id DESC').includes(:manifestation))
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should get index txt without user_id' do
|
42
42
|
get :index, format: 'txt'
|
43
|
-
response.should
|
43
|
+
response.should be_successful
|
44
44
|
assigns(:reserves).count.should eq assigns(:reserves).total_entries
|
45
45
|
assigns(:reserves).should eq(Reserve.order('reserves.id DESC').includes(:manifestation))
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'should get index feed with user_id' do
|
49
49
|
get :index, params: { user_id: users(:user1).username, format: 'rss' }
|
50
|
-
response.should
|
50
|
+
response.should be_successful
|
51
51
|
assigns(:reserves).should eq(users(:user1).reserves.order('reserves.id DESC').includes(:manifestation).page(1))
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'should get index txt with user_id' do
|
55
55
|
get :index, params: { user_id: users(:user1).username, format: 'txt' }
|
56
|
-
response.should
|
56
|
+
response.should be_successful
|
57
57
|
assigns(:reserves).should eq(users(:user1).reserves.order('reserves.id DESC').includes(:manifestation))
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should get other user's index" do
|
61
61
|
get :index, params: { user_id: users(:user1).username }
|
62
|
-
response.should
|
62
|
+
response.should be_successful
|
63
63
|
assigns(:reserves).should eq(users(:user1).reserves.order('reserves.id DESC').includes(:manifestation).page(1))
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should get other user's index feed" do
|
67
67
|
get :index, params: { user_id: users(:user1).username, format: :rss }
|
68
|
-
response.should
|
68
|
+
response.should be_successful
|
69
69
|
assigns(:reserves).should eq(users(:user1).reserves.order('reserves.id DESC').includes(:manifestation).page(1))
|
70
70
|
end
|
71
71
|
end
|
@@ -80,18 +80,18 @@ describe ReservesController do
|
|
80
80
|
|
81
81
|
it 'should be redirected to my index' do
|
82
82
|
get :index
|
83
|
-
response.should
|
83
|
+
response.should be_successful
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'should get my index feed' do
|
87
87
|
get :index, format: :rss
|
88
|
-
response.should
|
88
|
+
response.should be_successful
|
89
89
|
response.should render_template('index')
|
90
90
|
end
|
91
91
|
|
92
92
|
it 'should get my index txt' do
|
93
93
|
get :index, format: :txt
|
94
|
-
response.should
|
94
|
+
response.should be_successful
|
95
95
|
response.should render_template('index')
|
96
96
|
end
|
97
97
|
|
@@ -150,7 +150,7 @@ describe ReservesController do
|
|
150
150
|
|
151
151
|
it "should show other user's reservation" do
|
152
152
|
get :show, params: { id: 3 }
|
153
|
-
response.should
|
153
|
+
response.should be_successful
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
@@ -165,7 +165,7 @@ describe ReservesController do
|
|
165
165
|
|
166
166
|
it "should show other user's reservation" do
|
167
167
|
get :show, params: { id: 3 }
|
168
|
-
response.should
|
168
|
+
response.should be_successful
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
@@ -180,7 +180,7 @@ describe ReservesController do
|
|
180
180
|
|
181
181
|
it 'should show my reservation' do
|
182
182
|
get :show, params: { id: 3 }
|
183
|
-
response.should
|
183
|
+
response.should be_successful
|
184
184
|
end
|
185
185
|
|
186
186
|
it "should not show other user's reservation" do
|
@@ -218,7 +218,7 @@ describe ReservesController do
|
|
218
218
|
it "should get other user's reservation" do
|
219
219
|
get :new, params: { user_id: users(:user1).username, manifestation_id: 3 }
|
220
220
|
assigns(:reserve).user.should eq users(:user1)
|
221
|
-
response.should
|
221
|
+
response.should be_successful
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
@@ -232,13 +232,13 @@ describe ReservesController do
|
|
232
232
|
|
233
233
|
it 'should get new template without user_id' do
|
234
234
|
get :new, params: { manifestation_id: 3 }
|
235
|
-
response.should
|
235
|
+
response.should be_successful
|
236
236
|
end
|
237
237
|
|
238
238
|
it "should get other user's reservation" do
|
239
239
|
get :new, params: { user_id: users(:user1).username, manifestation_id: 3 }
|
240
240
|
assigns(:reserve).user.should eq users(:user1)
|
241
|
-
response.should
|
241
|
+
response.should be_successful
|
242
242
|
end
|
243
243
|
end
|
244
244
|
|
@@ -248,12 +248,12 @@ describe ReservesController do
|
|
248
248
|
it 'should not assign the requested reserve as @reserve' do
|
249
249
|
get :new
|
250
250
|
assigns(:reserve).should_not be_valid
|
251
|
-
response.should
|
251
|
+
response.should be_successful
|
252
252
|
end
|
253
253
|
|
254
254
|
it 'should get my new reservation' do
|
255
255
|
get :new, params: { manifestation_id: 3 }
|
256
|
-
response.should
|
256
|
+
response.should be_successful
|
257
257
|
end
|
258
258
|
|
259
259
|
it "should not get other user's new reservation" do
|
@@ -289,7 +289,7 @@ describe ReservesController do
|
|
289
289
|
|
290
290
|
it "should edit other user's reservation" do
|
291
291
|
get :edit, params: { id: 3 }
|
292
|
-
response.should
|
292
|
+
response.should be_successful
|
293
293
|
end
|
294
294
|
end
|
295
295
|
|
@@ -304,7 +304,7 @@ describe ReservesController do
|
|
304
304
|
|
305
305
|
it 'should edit reserve without user_id' do
|
306
306
|
get :edit, params: { id: 3 }
|
307
|
-
response.should
|
307
|
+
response.should be_successful
|
308
308
|
end
|
309
309
|
end
|
310
310
|
|
@@ -319,7 +319,7 @@ describe ReservesController do
|
|
319
319
|
|
320
320
|
it 'should edit my reservation' do
|
321
321
|
get :edit, params: { id: 3 }
|
322
|
-
response.should
|
322
|
+
response.should be_successful
|
323
323
|
end
|
324
324
|
|
325
325
|
it "should not edit other user's reservation" do
|
@@ -369,14 +369,14 @@ describe ReservesController do
|
|
369
369
|
post :create, params: { reserve: @invalid_attrs }
|
370
370
|
assigns(:reserve).expired_at.should be_nil
|
371
371
|
response.should render_template('new')
|
372
|
-
response.should
|
372
|
+
response.should be_successful
|
373
373
|
end
|
374
374
|
end
|
375
375
|
|
376
376
|
it 'should not create reservation with past date' do
|
377
377
|
post :create, params: { reserve: { user_number: users(:user1).profile.user_number, manifestation_id: 5, expired_at: '1901-01-01' } }
|
378
378
|
assigns(:reserve).should_not be_valid
|
379
|
-
response.should
|
379
|
+
response.should be_successful
|
380
380
|
end
|
381
381
|
|
382
382
|
it "should create other user's reserve" do
|
@@ -387,13 +387,13 @@ describe ReservesController do
|
|
387
387
|
|
388
388
|
it 'should not create reserve without manifestation_id' do
|
389
389
|
post :create, params: { reserve: { user_number: users(:admin).profile.user_number } }
|
390
|
-
response.should
|
390
|
+
response.should be_successful
|
391
391
|
end
|
392
392
|
|
393
393
|
it 'should not create reserve with missing user_number' do
|
394
394
|
post :create, params: { reserve: { user_number: 'missing', manifestation_id: 5 } }
|
395
395
|
response.should render_template('new')
|
396
|
-
response.should
|
396
|
+
response.should be_successful
|
397
397
|
end
|
398
398
|
end
|
399
399
|
|
@@ -429,7 +429,7 @@ describe ReservesController do
|
|
429
429
|
post :create, params: { reserve: @invalid_attrs }
|
430
430
|
assigns(:reserve).expired_at.should be_nil
|
431
431
|
response.should render_template('new')
|
432
|
-
response.should
|
432
|
+
response.should be_successful
|
433
433
|
end
|
434
434
|
end
|
435
435
|
|
@@ -472,7 +472,7 @@ describe ReservesController do
|
|
472
472
|
post :create, params: { reserve: @invalid_attrs }
|
473
473
|
assigns(:reserve).expired_at.should be_nil
|
474
474
|
response.should render_template('new')
|
475
|
-
response.should
|
475
|
+
response.should be_successful
|
476
476
|
end
|
477
477
|
end
|
478
478
|
|
@@ -547,7 +547,7 @@ describe ReservesController do
|
|
547
547
|
it 'should not update reserve without manifestation_id' do
|
548
548
|
put :update, params: { id: 1, reserve: { user_number: users(:admin).profile.user_number, manifestation_id: nil } }
|
549
549
|
assigns(:reserve).should_not be_valid
|
550
|
-
response.should
|
550
|
+
response.should be_successful
|
551
551
|
end
|
552
552
|
|
553
553
|
it "should update other user's reservation without user_id" do
|
@@ -559,13 +559,13 @@ describe ReservesController do
|
|
559
559
|
it 'should not update retained reservations if item_identifier is invalid' do
|
560
560
|
put :update, params: { id: 14, reserve: { item_identifier: 'invalid' } }
|
561
561
|
assigns(:reserve).should_not be_valid
|
562
|
-
response.should
|
562
|
+
response.should be_successful
|
563
563
|
end
|
564
564
|
|
565
565
|
it 'should not update retained reservations if force_retaining is disabled' do
|
566
566
|
put :update, params: { id: 15, reserve: { item_identifier: '00021' } }
|
567
567
|
assigns(:reserve).should_not be_valid
|
568
|
-
response.should
|
568
|
+
response.should be_successful
|
569
569
|
assigns(:reserve).current_state.should eq 'requested'
|
570
570
|
reserves(:reserve_00014).current_state.should eq 'retained'
|
571
571
|
end
|