enju_biblio 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/assets/images/icons/book.png +0 -0
- data/app/assets/images/icons/cd.png +0 -0
- data/app/assets/images/icons/dvd.png +0 -0
- data/app/assets/images/icons/monitor.png +0 -0
- data/app/controllers/carrier_types_controller.rb +8 -3
- data/app/controllers/manifestations_controller.rb +17 -4
- data/app/controllers/picture_files_controller.rb +1 -1
- data/app/controllers/series_statements_controller.rb +6 -0
- data/app/helpers/manifestations_helper.rb +1 -1
- data/app/models/agent_import_file_transition.rb +1 -0
- data/app/models/carrier_type.rb +11 -7
- data/app/models/import_request_transition.rb +1 -0
- data/app/models/manifestation.rb +5 -0
- data/app/models/resource_export_file_transition.rb +1 -0
- data/app/models/resource_import_file_transition.rb +1 -0
- data/app/views/carrier_types/index.html.erb +4 -1
- data/app/views/manifestations/_show_detail_librarian.html.erb +4 -0
- data/app/views/manifestations/index.html.erb +3 -0
- data/config/locales/translation_en.yml +2 -0
- data/config/locales/translation_ja.yml +2 -0
- data/lib/enju_biblio/biblio_helper.rb +1 -12
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/generators/enju_biblio/setup/templates/config/schedule.rb +3 -3
- data/lib/tasks/carrier_type.rb +30 -18
- data/lib/tasks/enju_biblio_tasks.rake +2 -0
- data/spec/controllers/agent_import_files_controller_spec.rb +87 -87
- data/spec/controllers/agent_import_results_controller_spec.rb +22 -22
- data/spec/controllers/agent_merge_lists_controller_spec.rb +157 -157
- data/spec/controllers/agent_merges_controller_spec.rb +151 -151
- data/spec/controllers/agent_relationship_types_controller_spec.rb +152 -152
- data/spec/controllers/agent_relationships_controller_spec.rb +153 -153
- data/spec/controllers/agent_types_controller_spec.rb +49 -50
- data/spec/controllers/agents_controller_spec.rb +234 -234
- data/spec/controllers/carrier_types_controller_spec.rb +123 -103
- data/spec/controllers/content_types_controller_spec.rb +51 -52
- data/spec/controllers/countries_controller_spec.rb +156 -156
- data/spec/controllers/create_types_controller_spec.rb +48 -49
- data/spec/controllers/creates_controller_spec.rb +154 -154
- data/spec/controllers/donates_controller_spec.rb +153 -153
- data/spec/controllers/form_of_works_controller_spec.rb +48 -49
- data/spec/controllers/frequencies_controller_spec.rb +51 -52
- data/spec/controllers/identifier_types_controller_spec.rb +48 -49
- data/spec/controllers/import_requests_controller_spec.rb +165 -164
- data/spec/controllers/items_controller_spec.rb +214 -216
- data/spec/controllers/languages_controller_spec.rb +109 -109
- data/spec/controllers/licenses_controller_spec.rb +48 -49
- data/spec/controllers/manifestation_relationship_types_controller_spec.rb +152 -152
- data/spec/controllers/manifestation_relationships_controller_spec.rb +153 -153
- data/spec/controllers/manifestations_controller_spec.rb +319 -289
- data/spec/controllers/medium_of_performances_controller_spec.rb +48 -49
- data/spec/controllers/owns_controller_spec.rb +153 -153
- data/spec/controllers/picture_files_controller_spec.rb +156 -156
- data/spec/controllers/produce_types_controller_spec.rb +48 -49
- data/spec/controllers/produces_controller_spec.rb +154 -154
- data/spec/controllers/realize_types_controller_spec.rb +48 -49
- data/spec/controllers/realizes_controller_spec.rb +155 -155
- data/spec/controllers/resource_export_files_controller_spec.rb +72 -72
- data/spec/controllers/resource_import_files_controller_spec.rb +90 -90
- data/spec/controllers/resource_import_results_controller_spec.rb +43 -43
- data/spec/controllers/series_statement_merge_lists_controller_spec.rb +153 -153
- data/spec/controllers/series_statement_merges_controller_spec.rb +151 -151
- data/spec/controllers/series_statements_controller_spec.rb +154 -154
- data/spec/factories/checkout.rb +9 -0
- data/spec/factories/library.rb +13 -0
- data/spec/factories/shelf.rb +6 -0
- data/spec/fixtures/carrier_types.yml +11 -7
- data/spec/models/carrier_type_spec.rb +11 -7
- data/spec/models/resource_export_file_spec.rb +58 -16
- data/spec/support/resque.rb +0 -1
- data/spec/views/manifestations/show.html.erb_spec.rb +5 -0
- data/spec/views/resource_import_files/index.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_files/show.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_results/index.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_results/show.html.erb_spec.rb +1 -1
- metadata +49 -39
@@ -9,113 +9,113 @@ describe DonatesController do
|
|
9
9
|
FactoryGirl.attributes_for(:donate)
|
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 donates as @donates' do
|
17
17
|
get :index
|
18
18
|
expect(assigns(:donates)).to eq(Donate.order('id DESC').page(1))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe
|
22
|
+
describe 'When logged in as Librarian' do
|
23
23
|
login_fixture_librarian
|
24
24
|
|
25
|
-
it
|
25
|
+
it 'assigns all donates as @donates' do
|
26
26
|
get :index
|
27
27
|
expect(assigns(:donates)).to eq(Donate.order('id DESC').page(1))
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe
|
31
|
+
describe 'When logged in as User' do
|
32
32
|
login_fixture_user
|
33
33
|
|
34
|
-
it
|
34
|
+
it 'assigns all donates as @donates' do
|
35
35
|
get :index
|
36
36
|
expect(assigns(:donates)).to be_nil
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
it
|
40
|
+
describe 'When not logged in' do
|
41
|
+
it 'assigns all donates as @donates' do
|
42
42
|
get :index
|
43
43
|
expect(assigns(:donates)).to be_nil
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe
|
49
|
-
describe
|
48
|
+
describe 'GET show' do
|
49
|
+
describe 'When logged in as Administrator' do
|
50
50
|
login_fixture_admin
|
51
51
|
|
52
|
-
it
|
52
|
+
it 'assigns the requested donate as @donate' do
|
53
53
|
donate = FactoryGirl.create(:donate)
|
54
|
-
get :show, :
|
54
|
+
get :show, id: donate.id
|
55
55
|
expect(assigns(:donate)).to eq(donate)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
describe
|
59
|
+
describe 'When logged in as Librarian' do
|
60
60
|
login_fixture_librarian
|
61
61
|
|
62
|
-
it
|
62
|
+
it 'assigns the requested donate as @donate' do
|
63
63
|
donate = FactoryGirl.create(:donate)
|
64
|
-
get :show, :
|
64
|
+
get :show, id: donate.id
|
65
65
|
expect(assigns(:donate)).to eq(donate)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
describe
|
69
|
+
describe 'When logged in as User' do
|
70
70
|
login_fixture_user
|
71
71
|
|
72
|
-
it
|
72
|
+
it 'assigns the requested donate as @donate' do
|
73
73
|
donate = FactoryGirl.create(:donate)
|
74
|
-
get :show, :
|
74
|
+
get :show, id: donate.id
|
75
75
|
expect(assigns(:donate)).to eq(donate)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
describe
|
80
|
-
it
|
79
|
+
describe 'When not logged in' do
|
80
|
+
it 'assigns the requested donate as @donate' do
|
81
81
|
donate = FactoryGirl.create(:donate)
|
82
|
-
get :show, :
|
82
|
+
get :show, id: donate.id
|
83
83
|
expect(assigns(:donate)).to eq(donate)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
describe
|
89
|
-
describe
|
90
|
-
|
88
|
+
describe 'GET new' do
|
89
|
+
describe 'When logged in as Administrator' do
|
90
|
+
login_fixture_admin
|
91
91
|
|
92
|
-
it
|
92
|
+
it 'assigns the requested donate as @donate' do
|
93
93
|
get :new
|
94
94
|
expect(assigns(:donate)).not_to be_valid
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
describe
|
98
|
+
describe 'When logged in as Librarian' do
|
99
99
|
login_fixture_librarian
|
100
100
|
|
101
|
-
it
|
101
|
+
it 'assigns the requested donate as @donate' do
|
102
102
|
get :new
|
103
103
|
expect(assigns(:donate)).not_to be_valid
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
describe
|
107
|
+
describe 'When logged in as User' do
|
108
108
|
login_fixture_user
|
109
109
|
|
110
|
-
it
|
110
|
+
it 'should not assign the requested donate as @donate' do
|
111
111
|
get :new
|
112
112
|
expect(assigns(:donate)).to be_nil
|
113
113
|
expect(response).to be_forbidden
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
describe
|
118
|
-
it
|
117
|
+
describe 'When not logged in' do
|
118
|
+
it 'should not assign the requested donate as @donate' do
|
119
119
|
get :new
|
120
120
|
expect(assigns(:donate)).to be_nil
|
121
121
|
expect(response).to redirect_to(new_user_session_url)
|
@@ -123,315 +123,315 @@ describe DonatesController do
|
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
-
describe
|
127
|
-
describe
|
126
|
+
describe 'GET edit' do
|
127
|
+
describe 'When logged in as Administrator' do
|
128
128
|
login_fixture_admin
|
129
129
|
|
130
|
-
it
|
130
|
+
it 'assigns the requested donate as @donate' do
|
131
131
|
donate = FactoryGirl.create(:donate)
|
132
|
-
get :edit, :
|
132
|
+
get :edit, id: donate.id
|
133
133
|
expect(assigns(:donate)).to eq(donate)
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
-
describe
|
137
|
+
describe 'When logged in as Librarian' do
|
138
138
|
login_fixture_librarian
|
139
139
|
|
140
|
-
it
|
140
|
+
it 'assigns the requested donate as @donate' do
|
141
141
|
donate = FactoryGirl.create(:donate)
|
142
|
-
get :edit, :
|
142
|
+
get :edit, id: donate.id
|
143
143
|
expect(assigns(:donate)).to eq(donate)
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
-
describe
|
147
|
+
describe 'When logged in as User' do
|
148
148
|
login_fixture_user
|
149
149
|
|
150
|
-
it
|
150
|
+
it 'assigns the requested donate as @donate' do
|
151
151
|
donate = FactoryGirl.create(:donate)
|
152
|
-
get :edit, :
|
152
|
+
get :edit, id: donate.id
|
153
153
|
expect(response).to be_forbidden
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
describe
|
158
|
-
it
|
157
|
+
describe 'When not logged in' do
|
158
|
+
it 'should not assign the requested donate as @donate' do
|
159
159
|
donate = FactoryGirl.create(:donate)
|
160
|
-
get :edit, :
|
160
|
+
get :edit, id: donate.id
|
161
161
|
expect(response).to redirect_to(new_user_session_url)
|
162
162
|
end
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
-
describe
|
166
|
+
describe 'POST create' do
|
167
167
|
before(:each) do
|
168
168
|
@attrs = valid_attributes
|
169
|
-
@invalid_attrs = {:
|
169
|
+
@invalid_attrs = { item_id: '' }
|
170
170
|
end
|
171
171
|
|
172
|
-
describe
|
172
|
+
describe 'When logged in as Administrator' do
|
173
173
|
login_fixture_admin
|
174
174
|
|
175
|
-
describe
|
176
|
-
it
|
177
|
-
post :create, :
|
175
|
+
describe 'with valid params' do
|
176
|
+
it 'assigns a newly created donate as @donate' do
|
177
|
+
post :create, donate: @attrs
|
178
178
|
expect(assigns(:donate)).to be_valid
|
179
179
|
end
|
180
180
|
|
181
|
-
it
|
182
|
-
post :create, :
|
181
|
+
it 'redirects to the created donate' do
|
182
|
+
post :create, donate: @attrs
|
183
183
|
expect(response).to redirect_to(donate_url(assigns(:donate)))
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
187
|
-
describe
|
188
|
-
it
|
189
|
-
post :create, :
|
187
|
+
describe 'with invalid params' do
|
188
|
+
it 'assigns a newly created but unsaved donate as @donate' do
|
189
|
+
post :create, donate: @invalid_attrs
|
190
190
|
expect(assigns(:donate)).not_to be_valid
|
191
191
|
end
|
192
192
|
|
193
193
|
it "re-renders the 'new' template" do
|
194
|
-
post :create, :
|
195
|
-
expect(response).to render_template(
|
194
|
+
post :create, donate: @invalid_attrs
|
195
|
+
expect(response).to render_template('new')
|
196
196
|
end
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
-
describe
|
200
|
+
describe 'When logged in as Librarian' do
|
201
201
|
login_fixture_librarian
|
202
202
|
|
203
|
-
describe
|
204
|
-
it
|
205
|
-
post :create, :
|
203
|
+
describe 'with valid params' do
|
204
|
+
it 'assigns a newly created donate as @donate' do
|
205
|
+
post :create, donate: @attrs
|
206
206
|
expect(assigns(:donate)).to be_valid
|
207
207
|
end
|
208
208
|
|
209
|
-
it
|
210
|
-
post :create, :
|
209
|
+
it 'redirects to the created donate' do
|
210
|
+
post :create, donate: @attrs
|
211
211
|
expect(response).to redirect_to(donate_url(assigns(:donate)))
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
215
|
-
describe
|
216
|
-
it
|
217
|
-
post :create, :
|
215
|
+
describe 'with invalid params' do
|
216
|
+
it 'assigns a newly created but unsaved donate as @donate' do
|
217
|
+
post :create, donate: @invalid_attrs
|
218
218
|
expect(assigns(:donate)).not_to be_valid
|
219
219
|
end
|
220
220
|
|
221
221
|
it "re-renders the 'new' template" do
|
222
|
-
post :create, :
|
223
|
-
expect(response).to render_template(
|
222
|
+
post :create, donate: @invalid_attrs
|
223
|
+
expect(response).to render_template('new')
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
227
227
|
|
228
|
-
describe
|
228
|
+
describe 'When logged in as User' do
|
229
229
|
login_fixture_user
|
230
230
|
|
231
|
-
describe
|
232
|
-
it
|
233
|
-
post :create, :
|
231
|
+
describe 'with valid params' do
|
232
|
+
it 'assigns a newly created donate as @donate' do
|
233
|
+
post :create, donate: @attrs
|
234
234
|
expect(assigns(:donate)).to be_nil
|
235
235
|
end
|
236
236
|
|
237
|
-
it
|
238
|
-
post :create, :
|
237
|
+
it 'should be forbidden' do
|
238
|
+
post :create, donate: @attrs
|
239
239
|
expect(response).to be_forbidden
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
243
|
-
describe
|
244
|
-
it
|
245
|
-
post :create, :
|
243
|
+
describe 'with invalid params' do
|
244
|
+
it 'assigns a newly created but unsaved donate as @donate' do
|
245
|
+
post :create, donate: @invalid_attrs
|
246
246
|
expect(assigns(:donate)).to be_nil
|
247
247
|
end
|
248
248
|
|
249
|
-
it
|
250
|
-
post :create, :
|
249
|
+
it 'should be forbidden' do
|
250
|
+
post :create, donate: @invalid_attrs
|
251
251
|
expect(response).to be_forbidden
|
252
252
|
end
|
253
253
|
end
|
254
254
|
end
|
255
255
|
|
256
|
-
describe
|
257
|
-
describe
|
258
|
-
it
|
259
|
-
post :create, :
|
256
|
+
describe 'When not logged in' do
|
257
|
+
describe 'with valid params' do
|
258
|
+
it 'assigns a newly created donate as @donate' do
|
259
|
+
post :create, donate: @attrs
|
260
260
|
expect(assigns(:donate)).to be_nil
|
261
261
|
end
|
262
262
|
|
263
|
-
it
|
264
|
-
post :create, :
|
263
|
+
it 'should be forbidden' do
|
264
|
+
post :create, donate: @attrs
|
265
265
|
expect(response).to redirect_to(new_user_session_url)
|
266
266
|
end
|
267
267
|
end
|
268
268
|
|
269
|
-
describe
|
270
|
-
it
|
271
|
-
post :create, :
|
269
|
+
describe 'with invalid params' do
|
270
|
+
it 'assigns a newly created but unsaved donate as @donate' do
|
271
|
+
post :create, donate: @invalid_attrs
|
272
272
|
expect(assigns(:donate)).to be_nil
|
273
273
|
end
|
274
274
|
|
275
|
-
it
|
276
|
-
post :create, :
|
275
|
+
it 'should be forbidden' do
|
276
|
+
post :create, donate: @invalid_attrs
|
277
277
|
expect(response).to redirect_to(new_user_session_url)
|
278
278
|
end
|
279
279
|
end
|
280
280
|
end
|
281
281
|
end
|
282
282
|
|
283
|
-
describe
|
283
|
+
describe 'PUT update' do
|
284
284
|
before(:each) do
|
285
285
|
@donate = FactoryGirl.create(:donate)
|
286
286
|
@attrs = valid_attributes
|
287
|
-
@invalid_attrs = {:
|
287
|
+
@invalid_attrs = { item_id: '' }
|
288
288
|
end
|
289
289
|
|
290
|
-
describe
|
290
|
+
describe 'When logged in as Administrator' do
|
291
291
|
login_fixture_admin
|
292
292
|
|
293
|
-
describe
|
294
|
-
it
|
295
|
-
put :update, :
|
293
|
+
describe 'with valid params' do
|
294
|
+
it 'updates the requested donate' do
|
295
|
+
put :update, id: @donate.id, donate: @attrs
|
296
296
|
end
|
297
297
|
|
298
|
-
it
|
299
|
-
put :update, :
|
298
|
+
it 'assigns the requested donate as @donate' do
|
299
|
+
put :update, id: @donate.id, donate: @attrs
|
300
300
|
expect(assigns(:donate)).to eq(@donate)
|
301
301
|
end
|
302
302
|
end
|
303
303
|
|
304
|
-
describe
|
305
|
-
it
|
306
|
-
put :update, :
|
307
|
-
expect(response).to render_template(
|
304
|
+
describe 'with invalid params' do
|
305
|
+
it 'assigns the requested donate as @donate' do
|
306
|
+
put :update, id: @donate.id, donate: @invalid_attrs
|
307
|
+
expect(response).to render_template('edit')
|
308
308
|
end
|
309
309
|
end
|
310
310
|
end
|
311
311
|
|
312
|
-
describe
|
312
|
+
describe 'When logged in as Librarian' do
|
313
313
|
login_fixture_librarian
|
314
314
|
|
315
|
-
describe
|
316
|
-
it
|
317
|
-
put :update, :
|
315
|
+
describe 'with valid params' do
|
316
|
+
it 'updates the requested donate' do
|
317
|
+
put :update, id: @donate.id, donate: @attrs
|
318
318
|
end
|
319
319
|
|
320
|
-
it
|
321
|
-
put :update, :
|
320
|
+
it 'assigns the requested donate as @donate' do
|
321
|
+
put :update, id: @donate.id, donate: @attrs
|
322
322
|
expect(assigns(:donate)).to eq(@donate)
|
323
323
|
expect(response).to redirect_to(@donate)
|
324
324
|
end
|
325
325
|
end
|
326
326
|
|
327
|
-
describe
|
328
|
-
it
|
329
|
-
put :update, :
|
327
|
+
describe 'with invalid params' do
|
328
|
+
it 'assigns the donate as @donate' do
|
329
|
+
put :update, id: @donate, donate: @invalid_attrs
|
330
330
|
expect(assigns(:donate)).not_to be_valid
|
331
331
|
end
|
332
332
|
|
333
333
|
it "re-renders the 'edit' template" do
|
334
|
-
put :update, :
|
335
|
-
expect(response).to render_template(
|
334
|
+
put :update, id: @donate, donate: @invalid_attrs
|
335
|
+
expect(response).to render_template('edit')
|
336
336
|
end
|
337
337
|
end
|
338
338
|
end
|
339
339
|
|
340
|
-
describe
|
340
|
+
describe 'When logged in as User' do
|
341
341
|
login_fixture_user
|
342
342
|
|
343
|
-
describe
|
344
|
-
it
|
345
|
-
put :update, :
|
343
|
+
describe 'with valid params' do
|
344
|
+
it 'updates the requested donate' do
|
345
|
+
put :update, id: @donate.id, donate: @attrs
|
346
346
|
end
|
347
347
|
|
348
|
-
it
|
349
|
-
put :update, :
|
348
|
+
it 'assigns the requested donate as @donate' do
|
349
|
+
put :update, id: @donate.id, donate: @attrs
|
350
350
|
expect(assigns(:donate)).to eq(@donate)
|
351
351
|
expect(response).to be_forbidden
|
352
352
|
end
|
353
353
|
end
|
354
354
|
|
355
|
-
describe
|
356
|
-
it
|
357
|
-
put :update, :
|
355
|
+
describe 'with invalid params' do
|
356
|
+
it 'assigns the requested donate as @donate' do
|
357
|
+
put :update, id: @donate.id, donate: @invalid_attrs
|
358
358
|
expect(response).to be_forbidden
|
359
359
|
end
|
360
360
|
end
|
361
361
|
end
|
362
362
|
|
363
|
-
describe
|
364
|
-
describe
|
365
|
-
it
|
366
|
-
put :update, :
|
363
|
+
describe 'When not logged in' do
|
364
|
+
describe 'with valid params' do
|
365
|
+
it 'updates the requested donate' do
|
366
|
+
put :update, id: @donate.id, donate: @attrs
|
367
367
|
end
|
368
368
|
|
369
|
-
it
|
370
|
-
put :update, :
|
369
|
+
it 'should be forbidden' do
|
370
|
+
put :update, id: @donate.id, donate: @attrs
|
371
371
|
expect(response).to redirect_to(new_user_session_url)
|
372
372
|
end
|
373
373
|
end
|
374
374
|
|
375
|
-
describe
|
376
|
-
it
|
377
|
-
put :update, :
|
375
|
+
describe 'with invalid params' do
|
376
|
+
it 'assigns the requested donate as @donate' do
|
377
|
+
put :update, id: @donate.id, donate: @invalid_attrs
|
378
378
|
expect(response).to redirect_to(new_user_session_url)
|
379
379
|
end
|
380
380
|
end
|
381
381
|
end
|
382
382
|
end
|
383
383
|
|
384
|
-
describe
|
384
|
+
describe 'DELETE destroy' do
|
385
385
|
before(:each) do
|
386
386
|
@donate = FactoryGirl.create(:donate)
|
387
387
|
end
|
388
388
|
|
389
|
-
describe
|
389
|
+
describe 'When logged in as Administrator' do
|
390
390
|
login_fixture_admin
|
391
391
|
|
392
|
-
it
|
393
|
-
delete :destroy, :
|
392
|
+
it 'destroys the requested donate' do
|
393
|
+
delete :destroy, id: @donate.id
|
394
394
|
end
|
395
395
|
|
396
|
-
it
|
397
|
-
delete :destroy, :
|
396
|
+
it 'redirects to the donates list' do
|
397
|
+
delete :destroy, id: @donate.id
|
398
398
|
expect(response).to redirect_to(donates_url)
|
399
399
|
end
|
400
400
|
end
|
401
401
|
|
402
|
-
describe
|
402
|
+
describe 'When logged in as Librarian' do
|
403
403
|
login_fixture_librarian
|
404
404
|
|
405
|
-
it
|
406
|
-
delete :destroy, :
|
405
|
+
it 'destroys the requested donate' do
|
406
|
+
delete :destroy, id: @donate.id
|
407
407
|
end
|
408
408
|
|
409
|
-
it
|
410
|
-
delete :destroy, :
|
409
|
+
it 'should be forbidden' do
|
410
|
+
delete :destroy, id: @donate.id
|
411
411
|
expect(response).to redirect_to(donates_url)
|
412
412
|
end
|
413
413
|
end
|
414
414
|
|
415
|
-
describe
|
415
|
+
describe 'When logged in as User' do
|
416
416
|
login_fixture_user
|
417
417
|
|
418
|
-
it
|
419
|
-
delete :destroy, :
|
418
|
+
it 'destroys the requested donate' do
|
419
|
+
delete :destroy, id: @donate.id
|
420
420
|
end
|
421
421
|
|
422
|
-
it
|
423
|
-
delete :destroy, :
|
422
|
+
it 'should be forbidden' do
|
423
|
+
delete :destroy, id: @donate.id
|
424
424
|
expect(response).to be_forbidden
|
425
425
|
end
|
426
426
|
end
|
427
427
|
|
428
|
-
describe
|
429
|
-
it
|
430
|
-
delete :destroy, :
|
428
|
+
describe 'When not logged in' do
|
429
|
+
it 'destroys the requested donate' do
|
430
|
+
delete :destroy, id: @donate.id
|
431
431
|
end
|
432
432
|
|
433
|
-
it
|
434
|
-
delete :destroy, :
|
433
|
+
it 'should be forbidden' do
|
434
|
+
delete :destroy, id: @donate.id
|
435
435
|
expect(response).to redirect_to(new_user_session_url)
|
436
436
|
end
|
437
437
|
end
|