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