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