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