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