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
@@ -3,37 +3,37 @@ require 'rails_helper'
|
|
3
3
|
describe ResourceExportFilesController do
|
4
4
|
fixtures :all
|
5
5
|
|
6
|
-
describe
|
7
|
-
describe
|
6
|
+
describe 'GET index' do
|
7
|
+
describe 'When logged in as Administrator' do
|
8
8
|
login_fixture_admin
|
9
9
|
|
10
|
-
it
|
10
|
+
it 'assigns all resource_export_files as @resource_export_files' do
|
11
11
|
get :index
|
12
12
|
expect(assigns(:resource_export_files)).to eq(ResourceExportFile.order('id DESC').page(1))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
16
|
+
describe 'When logged in as Librarian' do
|
17
17
|
login_fixture_librarian
|
18
18
|
|
19
|
-
it
|
19
|
+
it 'assigns all resource_export_files as @resource_export_files' do
|
20
20
|
get :index
|
21
21
|
expect(assigns(:resource_export_files)).to eq(ResourceExportFile.order('id DESC').page(1))
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
describe
|
25
|
+
describe 'When logged in as User' do
|
26
26
|
login_fixture_user
|
27
27
|
|
28
|
-
it
|
28
|
+
it 'assigns empty as @resource_export_files' do
|
29
29
|
get :index
|
30
30
|
expect(assigns(:resource_export_files)).to be_nil
|
31
31
|
expect(response).to be_forbidden
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
describe
|
36
|
-
it
|
35
|
+
describe 'When not logged in' do
|
36
|
+
it 'assigns empty as @resource_export_files' do
|
37
37
|
get :index
|
38
38
|
expect(assigns(:resource_export_files)).to be_nil
|
39
39
|
expect(response).to redirect_to(new_user_session_url)
|
@@ -41,39 +41,39 @@ describe ResourceExportFilesController do
|
|
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 resource_export_file as @resource_export_file' do
|
49
49
|
get :show, id: resource_export_files(:resource_export_file_00003).id
|
50
50
|
expect(assigns(:resource_export_file)).to eq(resource_export_files(:resource_export_file_00003))
|
51
51
|
expect(response).to be_success
|
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 resource_export_file as @resource_export_file' do
|
59
59
|
get :show, id: resource_export_files(:resource_export_file_00003).id
|
60
60
|
expect(assigns(:resource_export_file)).to eq(resource_export_files(:resource_export_file_00003))
|
61
61
|
expect(response).to be_success
|
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 resource_export_file as @resource_export_file' do
|
69
69
|
get :show, id: resource_export_files(:resource_export_file_00003).id
|
70
70
|
expect(assigns(:resource_export_file)).to eq(resource_export_files(:resource_export_file_00003))
|
71
71
|
expect(response).to be_forbidden
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
describe
|
76
|
-
it
|
75
|
+
describe 'When not logged in' do
|
76
|
+
it 'assigns the requested resource_export_file as @resource_export_file' do
|
77
77
|
get :show, id: resource_export_files(:resource_export_file_00003).id
|
78
78
|
expect(assigns(:resource_export_file)).to eq(resource_export_files(:resource_export_file_00003))
|
79
79
|
expect(response).to redirect_to(new_user_session_url)
|
@@ -81,39 +81,39 @@ describe ResourceExportFilesController do
|
|
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 resource_export_file as @resource_export_file' do
|
89
89
|
get :new
|
90
90
|
expect(assigns(:resource_export_file)).to be_valid
|
91
91
|
expect(response).to be_success
|
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 'should not assign the requested resource_export_file as @resource_export_file' do
|
99
99
|
get :new
|
100
100
|
expect(assigns(:resource_export_file)).to be_valid
|
101
101
|
expect(response).to be_success
|
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 resource_export_file as @resource_export_file' do
|
109
109
|
get :new
|
110
110
|
expect(assigns(:resource_export_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 resource_export_file as @resource_export_file' do
|
117
117
|
get :new
|
118
118
|
expect(assigns(:resource_export_file)).to be_nil
|
119
119
|
expect(response).to redirect_to(new_user_session_url)
|
@@ -121,70 +121,70 @@ describe ResourceExportFilesController do
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
describe
|
125
|
-
describe
|
124
|
+
describe 'POST create' do
|
125
|
+
describe 'When logged in as Librarian' do
|
126
126
|
login_fixture_librarian
|
127
127
|
|
128
|
-
it
|
129
|
-
post :create, resource_export_file: {mode: 'export'}
|
128
|
+
it 'should create agent_export_file' do
|
129
|
+
post :create, resource_export_file: { mode: 'export' }
|
130
130
|
expect(assigns(:resource_export_file)).to be_valid
|
131
131
|
assigns(:resource_export_file).user.username.should eq @user.username
|
132
132
|
expect(response).to redirect_to resource_export_file_url(assigns(:resource_export_file))
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
|
-
describe
|
136
|
+
describe 'When logged in as User' do
|
137
137
|
login_fixture_user
|
138
138
|
|
139
|
-
it
|
140
|
-
post :create, resource_export_file: {mode: 'export'}
|
139
|
+
it 'should be forbidden' do
|
140
|
+
post :create, resource_export_file: { mode: 'export' }
|
141
141
|
assigns(:resource_export_file).should be_nil
|
142
142
|
expect(response).to be_forbidden
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
-
describe
|
147
|
-
it
|
148
|
-
post :create, resource_export_file: {mode: 'export'}
|
146
|
+
describe 'When not logged in' do
|
147
|
+
it 'should be redirected to new session url' do
|
148
|
+
post :create, resource_export_file: { mode: 'export' }
|
149
149
|
assigns(:resource_export_file).should be_nil
|
150
150
|
expect(response).to redirect_to new_user_session_url
|
151
151
|
end
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
-
describe
|
156
|
-
describe
|
155
|
+
describe 'GET edit' do
|
156
|
+
describe 'When logged in as Administrator' do
|
157
157
|
login_fixture_admin
|
158
158
|
|
159
|
-
it
|
159
|
+
it 'assigns the requested resource_export_file as @resource_export_file' do
|
160
160
|
resource_export_file = resource_export_files(:resource_export_file_00001)
|
161
161
|
get :edit, id: resource_export_file.id
|
162
162
|
expect(assigns(:resource_export_file)).to eq(resource_export_file)
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
-
describe
|
166
|
+
describe 'When logged in as Librarian' do
|
167
167
|
login_fixture_librarian
|
168
168
|
|
169
|
-
it
|
169
|
+
it 'assigns the requested resource_export_file as @resource_export_file' do
|
170
170
|
resource_export_file = resource_export_files(:resource_export_file_00001)
|
171
171
|
get :edit, id: resource_export_file.id
|
172
172
|
expect(assigns(:resource_export_file)).to eq(resource_export_file)
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
176
|
-
describe
|
176
|
+
describe 'When logged in as User' do
|
177
177
|
login_fixture_user
|
178
178
|
|
179
|
-
it
|
179
|
+
it 'assigns the requested resource_export_file as @resource_export_file' do
|
180
180
|
resource_export_file = resource_export_files(:resource_export_file_00001)
|
181
181
|
get :edit, id: resource_export_file.id
|
182
182
|
expect(response).to be_forbidden
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
186
|
-
describe
|
187
|
-
it
|
186
|
+
describe 'When not logged in' do
|
187
|
+
it 'should not assign the requested resource_export_file as @resource_export_file' do
|
188
188
|
resource_export_file = resource_export_files(:resource_export_file_00001)
|
189
189
|
get :edit, id: resource_export_file.id
|
190
190
|
expect(response).to redirect_to(new_user_session_url)
|
@@ -192,92 +192,92 @@ describe ResourceExportFilesController do
|
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
195
|
-
describe
|
196
|
-
describe
|
195
|
+
describe 'PUT update' do
|
196
|
+
describe 'When logged in as Administrator' do
|
197
197
|
login_fixture_admin
|
198
198
|
|
199
|
-
it
|
200
|
-
put :update, id: resource_export_files(:resource_export_file_00003).id, resource_export_file: {mode: 'export'}
|
199
|
+
it 'should update resource_export_file' do
|
200
|
+
put :update, id: resource_export_files(:resource_export_file_00003).id, resource_export_file: { mode: 'export' }
|
201
201
|
expect(response).to redirect_to resource_export_file_url(assigns(:resource_export_file))
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
205
|
-
describe
|
205
|
+
describe 'When logged in as Librarian' do
|
206
206
|
login_fixture_librarian
|
207
207
|
|
208
|
-
it
|
209
|
-
put :update, id: resource_export_files(:resource_export_file_00003).id, resource_export_file: {mode: 'export'}
|
208
|
+
it 'should update resource_export_file' do
|
209
|
+
put :update, id: resource_export_files(:resource_export_file_00003).id, resource_export_file: { mode: 'export' }
|
210
210
|
expect(response).to redirect_to resource_export_file_url(assigns(:resource_export_file))
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
214
|
-
describe
|
214
|
+
describe 'When logged in as User' do
|
215
215
|
login_fixture_user
|
216
216
|
|
217
|
-
it
|
218
|
-
put :update, id: resource_export_files(:resource_export_file_00003).id, resource_export_file: {mode: 'export'}
|
217
|
+
it 'should not update resource_export_file' do
|
218
|
+
put :update, id: resource_export_files(:resource_export_file_00003).id, resource_export_file: { mode: 'export' }
|
219
219
|
expect(response).to be_forbidden
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
-
describe
|
224
|
-
it
|
225
|
-
put :update, id: resource_export_files(:resource_export_file_00003).id, resource_export_file: {mode: 'export'}
|
223
|
+
describe 'When not logged in' do
|
224
|
+
it 'should not update resource_export_file' do
|
225
|
+
put :update, id: resource_export_files(:resource_export_file_00003).id, resource_export_file: { mode: 'export' }
|
226
226
|
expect(response).to redirect_to new_user_session_url
|
227
227
|
end
|
228
228
|
end
|
229
229
|
end
|
230
230
|
|
231
|
-
describe
|
231
|
+
describe 'DELETE destroy' do
|
232
232
|
before(:each) do
|
233
233
|
@resource_export_file = resource_export_files(:resource_export_file_00001)
|
234
234
|
end
|
235
235
|
|
236
|
-
describe
|
236
|
+
describe 'When logged in as Administrator' do
|
237
237
|
login_fixture_admin
|
238
238
|
|
239
|
-
it
|
239
|
+
it 'destroys the requested resource_export_file' do
|
240
240
|
delete :destroy, id: @resource_export_file.id
|
241
241
|
end
|
242
242
|
|
243
|
-
it
|
243
|
+
it 'redirects to the resource_export_files list' do
|
244
244
|
delete :destroy, id: @resource_export_file.id
|
245
245
|
expect(response).to redirect_to(resource_export_files_url)
|
246
246
|
end
|
247
247
|
end
|
248
248
|
|
249
|
-
describe
|
249
|
+
describe 'When logged in as Librarian' do
|
250
250
|
login_fixture_librarian
|
251
251
|
|
252
|
-
it
|
252
|
+
it 'destroys the requested resource_export_file' do
|
253
253
|
delete :destroy, id: @resource_export_file.id
|
254
254
|
end
|
255
255
|
|
256
|
-
it
|
256
|
+
it 'redirects to the resource_export_files list' do
|
257
257
|
delete :destroy, id: @resource_export_file.id
|
258
258
|
expect(response).to redirect_to(resource_export_files_url)
|
259
259
|
end
|
260
260
|
end
|
261
261
|
|
262
|
-
describe
|
262
|
+
describe 'When logged in as User' do
|
263
263
|
login_fixture_user
|
264
264
|
|
265
|
-
it
|
265
|
+
it 'destroys the requested resource_export_file' do
|
266
266
|
delete :destroy, id: @resource_export_file.id
|
267
267
|
end
|
268
268
|
|
269
|
-
it
|
269
|
+
it 'should be forbidden' do
|
270
270
|
delete :destroy, id: @resource_export_file.id
|
271
271
|
expect(response).to be_forbidden
|
272
272
|
end
|
273
273
|
end
|
274
274
|
|
275
|
-
describe
|
276
|
-
it
|
275
|
+
describe 'When not logged in' do
|
276
|
+
it 'destroys the requested resource_export_file' do
|
277
277
|
delete :destroy, id: @resource_export_file.id
|
278
278
|
end
|
279
279
|
|
280
|
-
it
|
280
|
+
it 'should be forbidden' do
|
281
281
|
delete :destroy, id: @resource_export_file.id
|
282
282
|
expect(response).to redirect_to(new_user_session_url)
|
283
283
|
end
|
@@ -3,37 +3,37 @@ require 'rails_helper'
|
|
3
3
|
describe ResourceImportFilesController do
|
4
4
|
fixtures :all
|
5
5
|
|
6
|
-
describe
|
7
|
-
describe
|
6
|
+
describe 'GET index' do
|
7
|
+
describe 'When logged in as Administrator' do
|
8
8
|
login_fixture_admin
|
9
9
|
|
10
|
-
it
|
10
|
+
it 'assigns all resource_import_files as @resource_import_files' do
|
11
11
|
get :index
|
12
12
|
expect(assigns(:resource_import_files)).to eq(ResourceImportFile.page(1))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
16
|
+
describe 'When logged in as Librarian' do
|
17
17
|
login_fixture_librarian
|
18
18
|
|
19
|
-
it
|
19
|
+
it 'assigns all resource_import_files as @resource_import_files' do
|
20
20
|
get :index
|
21
21
|
expect(assigns(:resource_import_files)).to eq(ResourceImportFile.page(1))
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
describe
|
25
|
+
describe 'When logged in as User' do
|
26
26
|
login_fixture_user
|
27
27
|
|
28
|
-
it
|
28
|
+
it 'assigns empty as @resource_import_files' do
|
29
29
|
get :index
|
30
30
|
expect(assigns(:resource_import_files)).to be_nil
|
31
31
|
expect(response).to be_forbidden
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
describe
|
36
|
-
it
|
35
|
+
describe 'When not logged in' do
|
36
|
+
it 'assigns empty as @resource_import_files' do
|
37
37
|
get :index
|
38
38
|
expect(assigns(:resource_import_files)).to be_nil
|
39
39
|
expect(response).to redirect_to(new_user_session_url)
|
@@ -41,79 +41,79 @@ describe ResourceImportFilesController do
|
|
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
|
49
|
-
get :show, :
|
48
|
+
it 'assigns the requested resource_import_file as @resource_import_file' do
|
49
|
+
get :show, id: resource_import_files(:resource_import_file_00003).id
|
50
50
|
expect(assigns(:resource_import_file)).to eq(resource_import_files(:resource_import_file_00003))
|
51
51
|
expect(response).to be_success
|
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
|
59
|
-
get :show, :
|
58
|
+
it 'assigns the requested resource_import_file as @resource_import_file' do
|
59
|
+
get :show, id: resource_import_files(:resource_import_file_00003).id
|
60
60
|
expect(assigns(:resource_import_file)).to eq(resource_import_files(:resource_import_file_00003))
|
61
61
|
expect(response).to be_success
|
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
|
69
|
-
get :show, :
|
68
|
+
it 'assigns the requested resource_import_file as @resource_import_file' do
|
69
|
+
get :show, id: resource_import_files(:resource_import_file_00003).id
|
70
70
|
expect(assigns(:resource_import_file)).to eq(resource_import_files(:resource_import_file_00003))
|
71
71
|
expect(response).to be_forbidden
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
describe
|
76
|
-
it
|
77
|
-
get :show, :
|
75
|
+
describe 'When not logged in' do
|
76
|
+
it 'assigns the requested resource_import_file as @resource_import_file' do
|
77
|
+
get :show, id: resource_import_files(:resource_import_file_00003).id
|
78
78
|
expect(assigns(:resource_import_file)).to eq(resource_import_files(:resource_import_file_00003))
|
79
79
|
expect(response).to redirect_to(new_user_session_url)
|
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 resource_import_file as @resource_import_file' do
|
89
89
|
get :new
|
90
90
|
expect(assigns(:resource_import_file)).not_to be_valid
|
91
91
|
expect(response).to be_success
|
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 'should not assign the requested resource_import_file as @resource_import_file' do
|
99
99
|
get :new
|
100
100
|
expect(assigns(:resource_import_file)).not_to be_valid
|
101
101
|
expect(response).to be_success
|
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 resource_import_file as @resource_import_file' do
|
109
109
|
get :new
|
110
110
|
expect(assigns(:resource_import_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 resource_import_file as @resource_import_file' do
|
117
117
|
get :new
|
118
118
|
expect(assigns(:resource_import_file)).to be_nil
|
119
119
|
expect(response).to redirect_to(new_user_session_url)
|
@@ -121,177 +121,177 @@ describe ResourceImportFilesController do
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
describe
|
125
|
-
describe
|
124
|
+
describe 'POST create' do
|
125
|
+
describe 'When logged in as Librarian' do
|
126
126
|
before(:each) do
|
127
127
|
@user = users(:librarian1)
|
128
128
|
sign_in @user
|
129
129
|
end
|
130
130
|
|
131
|
-
it
|
132
|
-
post :create, :
|
131
|
+
it 'should create resource_import_file' do
|
132
|
+
post :create, resource_import_file: { resource_import: fixture_file_upload('/../../examples/resource_import_file_sample1.tsv', 'text/csv'), edit_mode: 'create', default_shelf_id: 1 }
|
133
133
|
expect(assigns(:resource_import_file)).to be_valid
|
134
134
|
assigns(:resource_import_file).user.username.should eq @user.username
|
135
135
|
expect(response).to redirect_to resource_import_file_url(assigns(:resource_import_file))
|
136
136
|
end
|
137
137
|
|
138
|
-
it
|
139
|
-
post :create, :
|
138
|
+
it 'should not create resource_import_file without default_shelf_id' do
|
139
|
+
post :create, resource_import_file: { resource_import: fixture_file_upload('/../../examples/resource_import_file_sample1.tsv', 'text/csv'), edit_mode: 'create' }
|
140
140
|
expect(assigns(:resource_import_file)).not_to be_valid
|
141
141
|
assigns(:resource_import_file).user.username.should eq @user.username
|
142
142
|
expect(response).to be_success
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
-
describe
|
146
|
+
describe 'When logged in as User' do
|
147
147
|
before(:each) do
|
148
148
|
@user = users(:user1)
|
149
149
|
sign_in @user
|
150
150
|
end
|
151
151
|
|
152
|
-
it
|
153
|
-
post :create, :
|
152
|
+
it 'should be forbidden' do
|
153
|
+
post :create, resource_import_file: { resource_import: fixture_file_upload('/../../examples/resource_import_file_sample1.tsv', 'text/csv') }
|
154
154
|
assigns(:resource_import_file).should be_nil
|
155
155
|
expect(response).to be_forbidden
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
|
-
describe
|
160
|
-
it
|
161
|
-
post :create, :
|
159
|
+
describe 'When not logged in' do
|
160
|
+
it 'should be redirected to new session url' do
|
161
|
+
post :create, resource_import_file: { resource_import: fixture_file_upload('/../../examples/resource_import_file_sample1.tsv', 'text/csv') }
|
162
162
|
assigns(:resource_import_file).should be_nil
|
163
163
|
expect(response).to redirect_to new_user_session_url
|
164
164
|
end
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
168
|
-
describe
|
169
|
-
describe
|
168
|
+
describe 'GET edit' do
|
169
|
+
describe 'When logged in as Administrator' do
|
170
170
|
login_fixture_admin
|
171
171
|
|
172
|
-
it
|
172
|
+
it 'assigns the requested resource_import_file as @resource_import_file' do
|
173
173
|
resource_import_file = resource_import_files(:resource_import_file_00001)
|
174
|
-
get :edit, :
|
174
|
+
get :edit, id: resource_import_file.id
|
175
175
|
expect(assigns(:resource_import_file)).to eq(resource_import_file)
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
|
-
describe
|
179
|
+
describe 'When logged in as Librarian' do
|
180
180
|
login_fixture_librarian
|
181
181
|
|
182
|
-
it
|
182
|
+
it 'assigns the requested resource_import_file as @resource_import_file' do
|
183
183
|
resource_import_file = resource_import_files(:resource_import_file_00001)
|
184
|
-
get :edit, :
|
184
|
+
get :edit, id: resource_import_file.id
|
185
185
|
expect(assigns(:resource_import_file)).to eq(resource_import_file)
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
|
-
describe
|
189
|
+
describe 'When logged in as User' do
|
190
190
|
login_fixture_user
|
191
191
|
|
192
|
-
it
|
192
|
+
it 'assigns the requested resource_import_file as @resource_import_file' do
|
193
193
|
resource_import_file = resource_import_files(:resource_import_file_00001)
|
194
|
-
get :edit, :
|
194
|
+
get :edit, id: resource_import_file.id
|
195
195
|
expect(response).to be_forbidden
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
-
describe
|
200
|
-
it
|
199
|
+
describe 'When not logged in' do
|
200
|
+
it 'should not assign the requested resource_import_file as @resource_import_file' do
|
201
201
|
resource_import_file = resource_import_files(:resource_import_file_00001)
|
202
|
-
get :edit, :
|
202
|
+
get :edit, id: resource_import_file.id
|
203
203
|
expect(response).to redirect_to(new_user_session_url)
|
204
204
|
end
|
205
205
|
end
|
206
206
|
end
|
207
207
|
|
208
|
-
describe
|
209
|
-
describe
|
208
|
+
describe 'PUT update' do
|
209
|
+
describe 'When logged in as Administrator' do
|
210
210
|
login_fixture_admin
|
211
211
|
|
212
|
-
it
|
213
|
-
put :update, :
|
212
|
+
it 'should update resource_import_file' do
|
213
|
+
put :update, id: resource_import_files(:resource_import_file_00003).id, resource_import_file: { mode: 'update' }
|
214
214
|
expect(response).to redirect_to resource_import_file_url(assigns(:resource_import_file))
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
218
|
-
describe
|
218
|
+
describe 'When logged in as Librarian' do
|
219
219
|
login_fixture_librarian
|
220
220
|
|
221
|
-
it
|
222
|
-
put :update, :
|
221
|
+
it 'should update resource_import_file' do
|
222
|
+
put :update, id: resource_import_files(:resource_import_file_00003).id, resource_import_file: { mode: 'update' }
|
223
223
|
expect(response).to redirect_to resource_import_file_url(assigns(:resource_import_file))
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
227
|
-
describe
|
227
|
+
describe 'When logged in as User' do
|
228
228
|
login_fixture_user
|
229
229
|
|
230
|
-
it
|
231
|
-
put :update, :
|
230
|
+
it 'should not update resource_import_file' do
|
231
|
+
put :update, id: resource_import_files(:resource_import_file_00003).id, resource_import_file: { mode: 'update' }
|
232
232
|
expect(response).to be_forbidden
|
233
233
|
end
|
234
234
|
end
|
235
235
|
|
236
|
-
describe
|
237
|
-
it
|
238
|
-
put :update, :
|
236
|
+
describe 'When not logged in' do
|
237
|
+
it 'should not update resource_import_file' do
|
238
|
+
put :update, id: resource_import_files(:resource_import_file_00003).id, resource_import_file: { mode: 'update' }
|
239
239
|
expect(response).to redirect_to new_user_session_url
|
240
240
|
end
|
241
241
|
end
|
242
242
|
end
|
243
243
|
|
244
|
-
describe
|
244
|
+
describe 'DELETE destroy' do
|
245
245
|
before(:each) do
|
246
246
|
@resource_import_file = resource_import_files(:resource_import_file_00001)
|
247
247
|
end
|
248
248
|
|
249
|
-
describe
|
249
|
+
describe 'When logged in as Administrator' do
|
250
250
|
login_fixture_admin
|
251
251
|
|
252
|
-
it
|
253
|
-
delete :destroy, :
|
252
|
+
it 'destroys the requested resource_import_file' do
|
253
|
+
delete :destroy, id: @resource_import_file.id
|
254
254
|
end
|
255
255
|
|
256
|
-
it
|
257
|
-
delete :destroy, :
|
256
|
+
it 'redirects to the resource_import_files list' do
|
257
|
+
delete :destroy, id: @resource_import_file.id
|
258
258
|
expect(response).to redirect_to(resource_import_files_url)
|
259
259
|
end
|
260
260
|
end
|
261
261
|
|
262
|
-
describe
|
262
|
+
describe 'When logged in as Librarian' do
|
263
263
|
login_fixture_librarian
|
264
264
|
|
265
|
-
it
|
266
|
-
delete :destroy, :
|
265
|
+
it 'destroys the requested resource_import_file' do
|
266
|
+
delete :destroy, id: @resource_import_file.id
|
267
267
|
end
|
268
268
|
|
269
|
-
it
|
270
|
-
delete :destroy, :
|
269
|
+
it 'redirects to the resource_import_files list' do
|
270
|
+
delete :destroy, id: @resource_import_file.id
|
271
271
|
expect(response).to redirect_to(resource_import_files_url)
|
272
272
|
end
|
273
273
|
end
|
274
274
|
|
275
|
-
describe
|
275
|
+
describe 'When logged in as User' do
|
276
276
|
login_fixture_user
|
277
277
|
|
278
|
-
it
|
279
|
-
delete :destroy, :
|
278
|
+
it 'destroys the requested resource_import_file' do
|
279
|
+
delete :destroy, id: @resource_import_file.id
|
280
280
|
end
|
281
281
|
|
282
|
-
it
|
283
|
-
delete :destroy, :
|
282
|
+
it 'should be forbidden' do
|
283
|
+
delete :destroy, id: @resource_import_file.id
|
284
284
|
expect(response).to be_forbidden
|
285
285
|
end
|
286
286
|
end
|
287
287
|
|
288
|
-
describe
|
289
|
-
it
|
290
|
-
delete :destroy, :
|
288
|
+
describe 'When not logged in' do
|
289
|
+
it 'destroys the requested resource_import_file' do
|
290
|
+
delete :destroy, id: @resource_import_file.id
|
291
291
|
end
|
292
292
|
|
293
|
-
it
|
294
|
-
delete :destroy, :
|
293
|
+
it 'should be forbidden' do
|
294
|
+
delete :destroy, id: @resource_import_file.id
|
295
295
|
expect(response).to redirect_to(new_user_session_url)
|
296
296
|
end
|
297
297
|
end
|