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,115 +5,115 @@ describe PictureFilesController 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 picture_files as @picture_files' do
|
13
13
|
get :index
|
14
14
|
expect(assigns(:picture_files)).to eq(PictureFile.attached.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 picture_files as @picture_files' do
|
22
22
|
get :index
|
23
23
|
expect(assigns(:picture_files)).to eq(PictureFile.attached.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 all picture_files as @picture_files' do
|
31
31
|
get :index
|
32
32
|
expect(assigns(:picture_files)).to eq(PictureFile.attached.page(1))
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
describe
|
37
|
-
it
|
36
|
+
describe 'When not logged in' do
|
37
|
+
it 'assigns all picture_files as @picture_files' do
|
38
38
|
get :index
|
39
39
|
expect(assigns(:picture_files)).to eq(PictureFile.attached.page(1))
|
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 picture_file as @picture_file' do
|
49
49
|
picture_file = PictureFile.find(1)
|
50
|
-
get :show, :
|
50
|
+
get :show, id: picture_file.id
|
51
51
|
expect(assigns(:picture_file)).to eq(picture_file)
|
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 picture_file as @picture_file' do
|
59
59
|
picture_file = PictureFile.find(1)
|
60
|
-
get :show, :
|
60
|
+
get :show, id: picture_file.id
|
61
61
|
expect(assigns(:picture_file)).to eq(picture_file)
|
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 picture_file as @picture_file' do
|
69
69
|
picture_file = PictureFile.find(1)
|
70
|
-
get :show, :
|
70
|
+
get :show, id: picture_file.id
|
71
71
|
expect(assigns(:picture_file)).to eq(picture_file)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
describe
|
76
|
-
it
|
75
|
+
describe 'When not logged in' do
|
76
|
+
it 'assigns the requested picture_file as @picture_file' do
|
77
77
|
picture_file = PictureFile.find(1)
|
78
|
-
get :show, :
|
78
|
+
get :show, id: picture_file.id
|
79
79
|
expect(assigns(:picture_file)).to eq(picture_file)
|
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 picture_file as @picture_file' do
|
89
89
|
get :new
|
90
90
|
expect(assigns(:picture_file)).to be_nil
|
91
91
|
expect(response).to redirect_to picture_files_url
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
describe
|
95
|
+
describe 'When logged in as Librarian' do
|
96
96
|
login_fixture_librarian
|
97
97
|
|
98
|
-
it
|
98
|
+
it 'assigns the requested picture_file as @picture_file' do
|
99
99
|
get :new
|
100
100
|
expect(assigns(:picture_file)).to be_nil
|
101
101
|
expect(response).to redirect_to picture_files_url
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
-
describe
|
105
|
+
describe 'When logged in as User' do
|
106
106
|
login_fixture_user
|
107
107
|
|
108
|
-
it
|
108
|
+
it 'should not assign the requested picture_file as @picture_file' do
|
109
109
|
get :new
|
110
110
|
expect(assigns(:picture_file)).to be_nil
|
111
111
|
expect(response).to be_forbidden
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
-
describe
|
116
|
-
it
|
115
|
+
describe 'When not logged in' do
|
116
|
+
it 'should not assign the requested picture_file as @picture_file' do
|
117
117
|
get :new
|
118
118
|
expect(assigns(:picture_file)).to be_nil
|
119
119
|
expect(response).to redirect_to(new_user_session_url)
|
@@ -121,320 +121,320 @@ describe PictureFilesController do
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
describe
|
125
|
-
describe
|
124
|
+
describe 'GET edit' do
|
125
|
+
describe 'When logged in as Administrator' do
|
126
126
|
login_fixture_admin
|
127
127
|
|
128
|
-
it
|
128
|
+
it 'assigns the requested picture_file as @picture_file' do
|
129
129
|
picture_file = PictureFile.find(1)
|
130
|
-
get :edit, :
|
130
|
+
get :edit, id: picture_file.id
|
131
131
|
expect(assigns(:picture_file)).to eq(picture_file)
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
-
describe
|
135
|
+
describe 'When logged in as Librarian' do
|
136
136
|
login_fixture_librarian
|
137
137
|
|
138
|
-
it
|
138
|
+
it 'assigns the requested picture_file as @picture_file' do
|
139
139
|
picture_file = PictureFile.find(1)
|
140
|
-
get :edit, :
|
140
|
+
get :edit, id: picture_file.id
|
141
141
|
expect(assigns(:picture_file)).to eq(picture_file)
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
-
describe
|
145
|
+
describe 'When logged in as User' do
|
146
146
|
login_fixture_user
|
147
147
|
|
148
|
-
it
|
148
|
+
it 'assigns the requested picture_file as @picture_file' do
|
149
149
|
picture_file = PictureFile.find(1)
|
150
|
-
get :edit, :
|
150
|
+
get :edit, id: picture_file.id
|
151
151
|
expect(response).to be_forbidden
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
-
describe
|
156
|
-
it
|
155
|
+
describe 'When not logged in' do
|
156
|
+
it 'should not assign the requested picture_file as @picture_file' do
|
157
157
|
picture_file = PictureFile.find(1)
|
158
|
-
get :edit, :
|
158
|
+
get :edit, id: picture_file.id
|
159
159
|
expect(response).to redirect_to(new_user_session_url)
|
160
160
|
end
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
-
describe
|
164
|
+
describe 'POST create' do
|
165
165
|
before(:each) do
|
166
|
-
@attrs = {:
|
167
|
-
@invalid_attrs = {:
|
166
|
+
@attrs = { picture_attachable_type: 'Shelf', picture_attachable_id: 1, picture: fixture_file_upload('/../../examples/spinner.gif', 'image/gif') }
|
167
|
+
@invalid_attrs = { picture_attachable_id: 'invalid', picture_attachable_type: 'Library' }
|
168
168
|
end
|
169
169
|
|
170
|
-
describe
|
170
|
+
describe 'When logged in as Administrator' do
|
171
171
|
login_fixture_admin
|
172
172
|
|
173
|
-
describe
|
174
|
-
it
|
175
|
-
post :create, :
|
173
|
+
describe 'with valid params' do
|
174
|
+
it 'assigns a newly created picture_file as @picture_file' do
|
175
|
+
post :create, picture_file: @attrs
|
176
176
|
expect(assigns(:picture_file)).to be_valid
|
177
177
|
end
|
178
178
|
|
179
|
-
it
|
180
|
-
post :create, :
|
179
|
+
it 'redirects to the created picture_file' do
|
180
|
+
post :create, picture_file: @attrs
|
181
181
|
expect(response).to redirect_to(picture_file_url(assigns(:picture_file)))
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
|
-
describe
|
186
|
-
it
|
187
|
-
post :create, :
|
185
|
+
describe 'with invalid params' do
|
186
|
+
it 'assigns a newly created but unsaved picture_file as @picture_file' do
|
187
|
+
post :create, picture_file: @invalid_attrs
|
188
188
|
expect(assigns(:picture_file)).not_to be_valid
|
189
189
|
end
|
190
190
|
|
191
191
|
it "re-renders the 'new' template" do
|
192
|
-
post :create, :
|
193
|
-
expect(response).to render_template(
|
192
|
+
post :create, picture_file: @invalid_attrs
|
193
|
+
expect(response).to render_template('new')
|
194
194
|
end
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
198
|
-
describe
|
198
|
+
describe 'When logged in as Librarian' do
|
199
199
|
login_fixture_librarian
|
200
200
|
|
201
|
-
describe
|
202
|
-
it
|
203
|
-
post :create, :
|
201
|
+
describe 'with valid params' do
|
202
|
+
it 'assigns a newly created picture_file as @picture_file' do
|
203
|
+
post :create, picture_file: @attrs
|
204
204
|
expect(assigns(:picture_file)).to be_valid
|
205
205
|
end
|
206
206
|
|
207
|
-
it
|
208
|
-
post :create, :
|
207
|
+
it 'redirects to the created picture_file' do
|
208
|
+
post :create, picture_file: @attrs
|
209
209
|
expect(response).to redirect_to(picture_file_url(assigns(:picture_file)))
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
213
|
-
describe
|
214
|
-
it
|
215
|
-
post :create, :
|
213
|
+
describe 'with invalid params' do
|
214
|
+
it 'assigns a newly created but unsaved picture_file as @picture_file' do
|
215
|
+
post :create, picture_file: @invalid_attrs
|
216
216
|
expect(assigns(:picture_file)).not_to be_valid
|
217
217
|
end
|
218
218
|
|
219
219
|
it "re-renders the 'new' template" do
|
220
|
-
post :create, :
|
221
|
-
expect(response).to render_template(
|
220
|
+
post :create, picture_file: @invalid_attrs
|
221
|
+
expect(response).to render_template('new')
|
222
222
|
end
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
|
-
describe
|
226
|
+
describe 'When logged in as User' do
|
227
227
|
login_fixture_user
|
228
228
|
|
229
|
-
describe
|
230
|
-
it
|
231
|
-
post :create, :
|
229
|
+
describe 'with valid params' do
|
230
|
+
it 'assigns a newly created picture_file as @picture_file' do
|
231
|
+
post :create, picture_file: @attrs
|
232
232
|
expect(assigns(:picture_file)).to be_nil
|
233
233
|
end
|
234
234
|
|
235
|
-
it
|
236
|
-
post :create, :
|
235
|
+
it 'should be forbidden' do
|
236
|
+
post :create, picture_file: @attrs
|
237
237
|
expect(response).to be_forbidden
|
238
238
|
end
|
239
239
|
end
|
240
240
|
|
241
|
-
describe
|
242
|
-
it
|
243
|
-
post :create, :
|
241
|
+
describe 'with invalid params' do
|
242
|
+
it 'assigns a newly created but unsaved picture_file as @picture_file' do
|
243
|
+
post :create, picture_file: @invalid_attrs
|
244
244
|
expect(assigns(:picture_file)).to be_nil
|
245
245
|
end
|
246
246
|
|
247
|
-
it
|
248
|
-
post :create, :
|
247
|
+
it 'should be forbidden' do
|
248
|
+
post :create, picture_file: @invalid_attrs
|
249
249
|
expect(response).to be_forbidden
|
250
250
|
end
|
251
251
|
end
|
252
252
|
end
|
253
253
|
|
254
|
-
describe
|
255
|
-
describe
|
256
|
-
it
|
257
|
-
post :create, :
|
254
|
+
describe 'When not logged in' do
|
255
|
+
describe 'with valid params' do
|
256
|
+
it 'assigns a newly created picture_file as @picture_file' do
|
257
|
+
post :create, picture_file: @attrs
|
258
258
|
expect(assigns(:picture_file)).to be_nil
|
259
259
|
end
|
260
260
|
|
261
|
-
it
|
262
|
-
post :create, :
|
261
|
+
it 'should be forbidden' do
|
262
|
+
post :create, picture_file: @attrs
|
263
263
|
expect(response).to redirect_to(new_user_session_url)
|
264
264
|
end
|
265
265
|
end
|
266
266
|
|
267
|
-
describe
|
268
|
-
it
|
269
|
-
post :create, :
|
267
|
+
describe 'with invalid params' do
|
268
|
+
it 'assigns a newly created but unsaved picture_file as @picture_file' do
|
269
|
+
post :create, picture_file: @invalid_attrs
|
270
270
|
expect(assigns(:picture_file)).to be_nil
|
271
271
|
end
|
272
272
|
|
273
|
-
it
|
274
|
-
post :create, :
|
273
|
+
it 'should be forbidden' do
|
274
|
+
post :create, picture_file: @invalid_attrs
|
275
275
|
expect(response).to redirect_to(new_user_session_url)
|
276
276
|
end
|
277
277
|
end
|
278
278
|
end
|
279
279
|
end
|
280
280
|
|
281
|
-
describe
|
281
|
+
describe 'PUT update' do
|
282
282
|
before(:each) do
|
283
283
|
@picture_file = picture_files(:picture_file_00001)
|
284
|
-
@attrs = {:
|
285
|
-
@invalid_attrs = {:
|
284
|
+
@attrs = { picture_attachable_id: '1', picture_attachable_type: 'Manifestation' }
|
285
|
+
@invalid_attrs = { picture_attachable_id: 'invalid', picture_attachable_type: 'Library' }
|
286
286
|
end
|
287
287
|
|
288
|
-
describe
|
288
|
+
describe 'When logged in as Administrator' do
|
289
289
|
login_fixture_admin
|
290
290
|
|
291
|
-
describe
|
292
|
-
it
|
293
|
-
put :update, :
|
291
|
+
describe 'with valid params' do
|
292
|
+
it 'updates the requested picture_file' do
|
293
|
+
put :update, id: @picture_file.id, picture_file: @attrs
|
294
294
|
end
|
295
295
|
|
296
|
-
it
|
297
|
-
put :update, :
|
296
|
+
it 'assigns the requested picture_file as @picture_file' do
|
297
|
+
put :update, id: @picture_file.id, picture_file: @attrs
|
298
298
|
expect(assigns(:picture_file)).to eq(@picture_file)
|
299
299
|
end
|
300
300
|
|
301
|
-
it
|
302
|
-
put :update, :
|
301
|
+
it 'moves its position when specified' do
|
302
|
+
put :update, id: @picture_file.id, move: 'lower'
|
303
303
|
expect(response).to redirect_to(picture_files_url(shelf_id: @picture_file.picture_attachable_id))
|
304
304
|
end
|
305
305
|
end
|
306
306
|
|
307
|
-
describe
|
308
|
-
it
|
309
|
-
put :update, :
|
310
|
-
expect(response).to render_template(
|
307
|
+
describe 'with invalid params' do
|
308
|
+
it 'assigns the requested picture_file as @picture_file' do
|
309
|
+
put :update, id: @picture_file.id, picture_file: @invalid_attrs
|
310
|
+
expect(response).to render_template('edit')
|
311
311
|
end
|
312
312
|
end
|
313
313
|
end
|
314
314
|
|
315
|
-
describe
|
315
|
+
describe 'When logged in as Librarian' do
|
316
316
|
login_fixture_librarian
|
317
317
|
|
318
|
-
describe
|
319
|
-
it
|
320
|
-
put :update, :
|
318
|
+
describe 'with valid params' do
|
319
|
+
it 'updates the requested picture_file' do
|
320
|
+
put :update, id: @picture_file.id, picture_file: @attrs
|
321
321
|
end
|
322
322
|
|
323
|
-
it
|
324
|
-
put :update, :
|
323
|
+
it 'assigns the requested picture_file as @picture_file' do
|
324
|
+
put :update, id: @picture_file.id, picture_file: @attrs
|
325
325
|
expect(assigns(:picture_file)).to eq(@picture_file)
|
326
326
|
expect(response).to redirect_to(@picture_file)
|
327
327
|
end
|
328
328
|
end
|
329
329
|
|
330
|
-
describe
|
331
|
-
it
|
332
|
-
put :update, :
|
330
|
+
describe 'with invalid params' do
|
331
|
+
it 'assigns the picture_file as @picture_file' do
|
332
|
+
put :update, id: @picture_file, picture_file: @invalid_attrs
|
333
333
|
expect(assigns(:picture_file)).not_to be_valid
|
334
334
|
end
|
335
335
|
|
336
336
|
it "re-renders the 'edit' template" do
|
337
|
-
put :update, :
|
338
|
-
expect(response).to render_template(
|
337
|
+
put :update, id: @picture_file, picture_file: @invalid_attrs
|
338
|
+
expect(response).to render_template('edit')
|
339
339
|
end
|
340
340
|
end
|
341
341
|
end
|
342
342
|
|
343
|
-
describe
|
343
|
+
describe 'When logged in as User' do
|
344
344
|
login_fixture_user
|
345
345
|
|
346
|
-
describe
|
347
|
-
it
|
348
|
-
put :update, :
|
346
|
+
describe 'with valid params' do
|
347
|
+
it 'updates the requested picture_file' do
|
348
|
+
put :update, id: @picture_file.id, picture_file: @attrs
|
349
349
|
end
|
350
350
|
|
351
|
-
it
|
352
|
-
put :update, :
|
351
|
+
it 'assigns the requested picture_file as @picture_file' do
|
352
|
+
put :update, id: @picture_file.id, picture_file: @attrs
|
353
353
|
expect(assigns(:picture_file)).to eq(@picture_file)
|
354
354
|
expect(response).to be_forbidden
|
355
355
|
end
|
356
356
|
end
|
357
357
|
|
358
|
-
describe
|
359
|
-
it
|
360
|
-
put :update, :
|
358
|
+
describe 'with invalid params' do
|
359
|
+
it 'assigns the requested picture_file as @picture_file' do
|
360
|
+
put :update, id: @picture_file.id, picture_file: @invalid_attrs
|
361
361
|
expect(response).to be_forbidden
|
362
362
|
end
|
363
363
|
end
|
364
364
|
end
|
365
365
|
|
366
|
-
describe
|
367
|
-
describe
|
368
|
-
it
|
369
|
-
put :update, :
|
366
|
+
describe 'When not logged in' do
|
367
|
+
describe 'with valid params' do
|
368
|
+
it 'updates the requested picture_file' do
|
369
|
+
put :update, id: @picture_file.id, picture_file: @attrs
|
370
370
|
end
|
371
371
|
|
372
|
-
it
|
373
|
-
put :update, :
|
372
|
+
it 'should be forbidden' do
|
373
|
+
put :update, id: @picture_file.id, picture_file: @attrs
|
374
374
|
expect(response).to redirect_to(new_user_session_url)
|
375
375
|
end
|
376
376
|
end
|
377
377
|
|
378
|
-
describe
|
379
|
-
it
|
380
|
-
put :update, :
|
378
|
+
describe 'with invalid params' do
|
379
|
+
it 'assigns the requested picture_file as @picture_file' do
|
380
|
+
put :update, id: @picture_file.id, picture_file: @invalid_attrs
|
381
381
|
expect(response).to redirect_to(new_user_session_url)
|
382
382
|
end
|
383
383
|
end
|
384
384
|
end
|
385
385
|
end
|
386
386
|
|
387
|
-
describe
|
387
|
+
describe 'DELETE destroy' do
|
388
388
|
before(:each) do
|
389
389
|
@picture_file = PictureFile.find(1)
|
390
390
|
end
|
391
391
|
|
392
|
-
describe
|
392
|
+
describe 'When logged in as Administrator' do
|
393
393
|
login_fixture_admin
|
394
394
|
|
395
|
-
it
|
396
|
-
delete :destroy, :
|
395
|
+
it 'destroys the requested picture_file' do
|
396
|
+
delete :destroy, id: @picture_file.id
|
397
397
|
end
|
398
398
|
|
399
|
-
it
|
400
|
-
delete :destroy, :
|
399
|
+
it 'redirects to the picture_files list' do
|
400
|
+
delete :destroy, id: @picture_file.id
|
401
401
|
expect(response).to redirect_to(picture_files_url(shelf_id: @picture_file.picture_attachable_id))
|
402
402
|
end
|
403
403
|
end
|
404
404
|
|
405
|
-
describe
|
405
|
+
describe 'When logged in as Librarian' do
|
406
406
|
login_fixture_librarian
|
407
407
|
|
408
|
-
it
|
409
|
-
delete :destroy, :
|
408
|
+
it 'destroys the requested picture_file' do
|
409
|
+
delete :destroy, id: @picture_file.id
|
410
410
|
end
|
411
411
|
|
412
|
-
it
|
413
|
-
delete :destroy, :
|
412
|
+
it 'should be forbidden' do
|
413
|
+
delete :destroy, id: @picture_file.id
|
414
414
|
expect(response).to redirect_to(picture_files_url(shelf_id: @picture_file.picture_attachable_id))
|
415
415
|
end
|
416
416
|
end
|
417
417
|
|
418
|
-
describe
|
418
|
+
describe 'When logged in as User' do
|
419
419
|
login_fixture_user
|
420
420
|
|
421
|
-
it
|
422
|
-
delete :destroy, :
|
421
|
+
it 'destroys the requested picture_file' do
|
422
|
+
delete :destroy, id: @picture_file.id
|
423
423
|
end
|
424
424
|
|
425
|
-
it
|
426
|
-
delete :destroy, :
|
425
|
+
it 'should be forbidden' do
|
426
|
+
delete :destroy, id: @picture_file.id
|
427
427
|
expect(response).to be_forbidden
|
428
428
|
end
|
429
429
|
end
|
430
430
|
|
431
|
-
describe
|
432
|
-
it
|
433
|
-
delete :destroy, :
|
431
|
+
describe 'When not logged in' do
|
432
|
+
it 'destroys the requested picture_file' do
|
433
|
+
delete :destroy, id: @picture_file.id
|
434
434
|
end
|
435
435
|
|
436
|
-
it
|
437
|
-
delete :destroy, :
|
436
|
+
it 'should be forbidden' do
|
437
|
+
delete :destroy, id: @picture_file.id
|
438
438
|
expect(response).to redirect_to(new_user_session_url)
|
439
439
|
end
|
440
440
|
end
|