enju_subject 0.2.0 → 0.2.1

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