enju_question 0.1.0.pre13 → 0.1.0.pre14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rdoc +8 -1
- data/app/controllers/answers_controller.rb +15 -2
- data/app/controllers/questions_controller.rb +7 -2
- data/app/models/answer.rb +0 -1
- data/app/models/answer_has_item.rb +0 -1
- data/app/models/question.rb +0 -1
- data/lib/enju_question/engine.rb +0 -1
- data/lib/enju_question/version.rb +1 -1
- data/spec/controllers/answers_controller_spec.rb +61 -61
- data/spec/controllers/questions_controller_spec.rb +70 -70
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/fixtures/users.yml +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +44 -82
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/dummy/solr/conf/admin-extra.html +0 -31
- data/spec/dummy/solr/conf/elevate.xml +0 -36
- data/spec/dummy/solr/conf/mapping-ISOLatin1Accent.txt +0 -246
- data/spec/dummy/solr/conf/protwords.txt +0 -21
- data/spec/dummy/solr/conf/schema.xml +0 -255
- data/spec/dummy/solr/conf/scripts.conf +0 -24
- data/spec/dummy/solr/conf/solrconfig.xml +0 -667
- data/spec/dummy/solr/conf/spellings.txt +0 -2
- data/spec/dummy/solr/conf/stopwords.txt +0 -58
- data/spec/dummy/solr/conf/synonyms.txt +0 -31
- data/spec/dummy/solr/default/data/index/segments.gen +0 -0
- data/spec/dummy/solr/default/data/index/segments_1km +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002027 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002028 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002029 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002030 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002031 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002032 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002033 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002034 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002035 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002036 +0 -0
- data/spec/dummy/solr/development/data/index/segments.gen +0 -0
- data/spec/dummy/solr/development/data/index/segments_1 +0 -0
- data/spec/dummy/solr/solr.xml +0 -8
- data/spec/dummy/solr/test/data/index/segments.gen +0 -0
- data/spec/dummy/solr/test/data/index/segments_1 +0 -0
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe QuestionsController do
|
4
4
|
fixtures :all
|
5
5
|
|
6
|
-
describe "GET index", :
|
6
|
+
describe "GET index", solr: true do
|
7
7
|
before do
|
8
8
|
Question.reindex
|
9
9
|
end
|
@@ -26,7 +26,7 @@ describe QuestionsController do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "assigns all questions as @questionsin rss format" do
|
29
|
-
get :index, :
|
29
|
+
get :index, format: :rss
|
30
30
|
assigns(:questions).should_not be_nil
|
31
31
|
end
|
32
32
|
end
|
@@ -40,25 +40,25 @@ describe QuestionsController do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should get my index feed" do
|
43
|
-
get :index, :
|
43
|
+
get :index, format: :rss
|
44
44
|
response.should be_success
|
45
45
|
assigns(:questions).should eq Question.public_questions.order(:updated_at).page(1)
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should redirect_to my index feed if user_id is specified" do
|
49
|
-
get :index, :
|
49
|
+
get :index, user_id: users(:user1).username, format: 'rss'
|
50
50
|
response.should be_success
|
51
51
|
assigns(:questions).should eq users(:user1).questions
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should get other user's index" do
|
55
|
-
get :index, :
|
55
|
+
get :index, user_id: users(:user2).username
|
56
56
|
response.should be_success
|
57
57
|
assigns(:questions).should_not be_empty
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should get other user's index feed" do
|
61
|
-
get :index, :
|
61
|
+
get :index, user_id: users(:user2).username, format: 'rss'
|
62
62
|
response.should be_success
|
63
63
|
assigns(:questions).should_not be_empty
|
64
64
|
end
|
@@ -78,7 +78,7 @@ describe QuestionsController do
|
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should render crd_xml template", :vcr => true do
|
81
|
-
get :index, :query => 'Yahoo', :mode => 'crd', :
|
81
|
+
get :index, :query => 'Yahoo', :mode => 'crd', format: :xml
|
82
82
|
response.should be_success
|
83
83
|
response.should render_template("questions/index_crd")
|
84
84
|
end
|
@@ -94,7 +94,7 @@ describe QuestionsController do
|
|
94
94
|
login_fixture_admin
|
95
95
|
|
96
96
|
it "assigns the requested question as @question" do
|
97
|
-
get :show, :
|
97
|
+
get :show, id: @question.id
|
98
98
|
assigns(:question).should eq(@question)
|
99
99
|
end
|
100
100
|
end
|
@@ -103,7 +103,7 @@ describe QuestionsController do
|
|
103
103
|
login_fixture_librarian
|
104
104
|
|
105
105
|
it "assigns the requested question as @question" do
|
106
|
-
get :show, :
|
106
|
+
get :show, id: @question.id
|
107
107
|
assigns(:question).should eq(@question)
|
108
108
|
end
|
109
109
|
end
|
@@ -112,30 +112,30 @@ describe QuestionsController do
|
|
112
112
|
login_fixture_user
|
113
113
|
|
114
114
|
it "assigns the requested question as @question" do
|
115
|
-
get :show, :
|
115
|
+
get :show, id: @question.id
|
116
116
|
assigns(:question).should eq(@question)
|
117
117
|
end
|
118
118
|
|
119
119
|
it "should show other user's question" do
|
120
|
-
get :show, :
|
120
|
+
get :show, id: 5
|
121
121
|
response.should be_success
|
122
122
|
end
|
123
123
|
|
124
124
|
it "should not show missing question" do
|
125
125
|
lambda{
|
126
|
-
get :show, :
|
126
|
+
get :show, id: 'missing'
|
127
127
|
}.should raise_error(ActiveRecord::RecordNotFound)
|
128
128
|
#response.should be_missing
|
129
129
|
end
|
130
130
|
|
131
131
|
it "should show my question" do
|
132
|
-
get :show, :
|
132
|
+
get :show, id: 3
|
133
133
|
assigns(:question).should eq Question.find(3)
|
134
134
|
response.should be_success
|
135
135
|
end
|
136
136
|
|
137
137
|
it "should show other user's shared question" do
|
138
|
-
get :show, :
|
138
|
+
get :show, id: 5
|
139
139
|
assigns(:question).should eq Question.find(5)
|
140
140
|
response.should be_success
|
141
141
|
end
|
@@ -143,12 +143,12 @@ describe QuestionsController do
|
|
143
143
|
|
144
144
|
describe "When not logged in" do
|
145
145
|
it "assigns the requested question as @question" do
|
146
|
-
get :show, :
|
146
|
+
get :show, id: @question.id
|
147
147
|
assigns(:question).should eq(@question)
|
148
148
|
end
|
149
149
|
|
150
150
|
it "should show crd xml" do
|
151
|
-
get :show, :
|
151
|
+
get :show, id: @question.id, :mode => 'crd', format: :xml
|
152
152
|
response.should be_success
|
153
153
|
response.should render_template("questions/show_crd")
|
154
154
|
end
|
@@ -201,7 +201,7 @@ describe QuestionsController do
|
|
201
201
|
login_fixture_admin
|
202
202
|
|
203
203
|
it "assigns the requested question as @question" do
|
204
|
-
get :edit, :
|
204
|
+
get :edit, id: @question.id
|
205
205
|
assigns(:question).should eq(@question)
|
206
206
|
end
|
207
207
|
end
|
@@ -210,7 +210,7 @@ describe QuestionsController do
|
|
210
210
|
login_fixture_librarian
|
211
211
|
|
212
212
|
it "assigns the requested question as @question" do
|
213
|
-
get :edit, :
|
213
|
+
get :edit, id: @question.id
|
214
214
|
assigns(:question).should eq(@question)
|
215
215
|
end
|
216
216
|
end
|
@@ -219,31 +219,31 @@ describe QuestionsController do
|
|
219
219
|
login_fixture_user
|
220
220
|
|
221
221
|
it "assigns the requested question as @question" do
|
222
|
-
get :edit, :
|
222
|
+
get :edit, id: @question.id
|
223
223
|
response.should be_forbidden
|
224
224
|
end
|
225
225
|
|
226
226
|
it "should not edit other user's question" do
|
227
|
-
get :edit, :
|
227
|
+
get :edit, id: 5
|
228
228
|
response.should be_forbidden
|
229
229
|
end
|
230
230
|
|
231
231
|
it "should not edit missing question" do
|
232
232
|
lambda{
|
233
|
-
get :edit, :
|
233
|
+
get :edit, id: 'missing'
|
234
234
|
}.should raise_error(ActiveRecord::RecordNotFound)
|
235
235
|
#response.should be_missing
|
236
236
|
end
|
237
237
|
|
238
238
|
it "should edit my question" do
|
239
|
-
get :edit, :
|
239
|
+
get :edit, id: 3
|
240
240
|
response.should be_success
|
241
241
|
end
|
242
242
|
end
|
243
243
|
|
244
244
|
describe "When not logged in" do
|
245
245
|
it "should not assign the requested question as @question" do
|
246
|
-
get :edit, :
|
246
|
+
get :edit, id: @question.id
|
247
247
|
response.should redirect_to(new_user_session_url)
|
248
248
|
end
|
249
249
|
end
|
@@ -252,7 +252,7 @@ describe QuestionsController do
|
|
252
252
|
describe "POST create" do
|
253
253
|
before(:each) do
|
254
254
|
@attrs = FactoryGirl.attributes_for(:question)
|
255
|
-
@invalid_attrs = {:
|
255
|
+
@invalid_attrs = {body: ''}
|
256
256
|
end
|
257
257
|
|
258
258
|
describe "When logged in as Administrator" do
|
@@ -260,24 +260,24 @@ describe QuestionsController do
|
|
260
260
|
|
261
261
|
describe "with valid params" do
|
262
262
|
it "assigns a newly created question as @question" do
|
263
|
-
post :create, :
|
263
|
+
post :create, question: @attrs
|
264
264
|
assigns(:question).should be_valid
|
265
265
|
end
|
266
266
|
|
267
267
|
it "redirects to the created question" do
|
268
|
-
post :create, :
|
268
|
+
post :create, question: @attrs
|
269
269
|
response.should redirect_to(question_url(assigns(:question)))
|
270
270
|
end
|
271
271
|
end
|
272
272
|
|
273
273
|
describe "with invalid params" do
|
274
274
|
it "assigns a newly created but unsaved question as @question" do
|
275
|
-
post :create, :
|
275
|
+
post :create, question: @invalid_attrs
|
276
276
|
assigns(:question).should_not be_valid
|
277
277
|
end
|
278
278
|
|
279
279
|
it "re-renders the 'new' template" do
|
280
|
-
post :create, :
|
280
|
+
post :create, question: @invalid_attrs
|
281
281
|
response.should render_template("new")
|
282
282
|
end
|
283
283
|
end
|
@@ -288,25 +288,25 @@ describe QuestionsController do
|
|
288
288
|
|
289
289
|
describe "with valid params" do
|
290
290
|
it "assigns a newly created question as @question" do
|
291
|
-
post :create, :
|
291
|
+
post :create, question: @attrs
|
292
292
|
assigns(:question).user.save!
|
293
293
|
assigns(:question).should be_valid
|
294
294
|
end
|
295
295
|
|
296
296
|
it "redirects to the created question" do
|
297
|
-
post :create, :
|
297
|
+
post :create, question: @attrs
|
298
298
|
response.should redirect_to(question_url(assigns(:question)))
|
299
299
|
end
|
300
300
|
end
|
301
301
|
|
302
302
|
describe "with invalid params" do
|
303
303
|
it "assigns a newly created but unsaved question as @question" do
|
304
|
-
post :create, :
|
304
|
+
post :create, question: @invalid_attrs
|
305
305
|
assigns(:question).should_not be_valid
|
306
306
|
end
|
307
307
|
|
308
308
|
it "re-renders the 'new' template" do
|
309
|
-
post :create, :
|
309
|
+
post :create, question: @invalid_attrs
|
310
310
|
response.should render_template("new")
|
311
311
|
end
|
312
312
|
end
|
@@ -317,24 +317,24 @@ describe QuestionsController do
|
|
317
317
|
|
318
318
|
describe "with valid params" do
|
319
319
|
it "assigns a newly created question as @question" do
|
320
|
-
post :create, :
|
320
|
+
post :create, question: @attrs
|
321
321
|
assigns(:question).should be_valid
|
322
322
|
end
|
323
323
|
|
324
324
|
it "redirects to the created question" do
|
325
|
-
post :create, :
|
325
|
+
post :create, question: @attrs
|
326
326
|
response.should redirect_to(question_url(assigns(:question)))
|
327
327
|
end
|
328
328
|
end
|
329
329
|
|
330
330
|
describe "with invalid params" do
|
331
331
|
it "assigns a newly created but unsaved question as @question" do
|
332
|
-
post :create, :
|
332
|
+
post :create, question: @invalid_attrs
|
333
333
|
assigns(:question).should_not be_valid
|
334
334
|
end
|
335
335
|
|
336
336
|
it "re-renders the 'new' template" do
|
337
|
-
post :create, :
|
337
|
+
post :create, question: @invalid_attrs
|
338
338
|
response.should render_template("new")
|
339
339
|
end
|
340
340
|
end
|
@@ -343,24 +343,24 @@ describe QuestionsController do
|
|
343
343
|
describe "When not logged in" do
|
344
344
|
describe "with valid params" do
|
345
345
|
it "assigns a newly created question as @question" do
|
346
|
-
post :create, :
|
346
|
+
post :create, question: @attrs
|
347
347
|
assigns(:question).should_not be_valid
|
348
348
|
end
|
349
349
|
|
350
350
|
it "should be forbidden" do
|
351
|
-
post :create, :
|
351
|
+
post :create, question: @attrs
|
352
352
|
response.should redirect_to(new_user_session_url)
|
353
353
|
end
|
354
354
|
end
|
355
355
|
|
356
356
|
describe "with invalid params" do
|
357
357
|
it "assigns a newly created but unsaved question as @question" do
|
358
|
-
post :create, :
|
358
|
+
post :create, question: @invalid_attrs
|
359
359
|
assigns(:question).should_not be_valid
|
360
360
|
end
|
361
361
|
|
362
362
|
it "should be forbidden" do
|
363
|
-
post :create, :
|
363
|
+
post :create, question: @invalid_attrs
|
364
364
|
response.should redirect_to(new_user_session_url)
|
365
365
|
end
|
366
366
|
end
|
@@ -371,7 +371,7 @@ describe QuestionsController do
|
|
371
371
|
before(:each) do
|
372
372
|
@question = FactoryGirl.create(:question)
|
373
373
|
@attrs = FactoryGirl.attributes_for(:question)
|
374
|
-
@invalid_attrs = {:
|
374
|
+
@invalid_attrs = {body: ''}
|
375
375
|
end
|
376
376
|
|
377
377
|
describe "When logged in as Administrator" do
|
@@ -379,35 +379,35 @@ describe QuestionsController do
|
|
379
379
|
|
380
380
|
describe "with valid params" do
|
381
381
|
it "updates the requested question" do
|
382
|
-
put :update, :
|
382
|
+
put :update, id: @question.id, question: @attrs
|
383
383
|
end
|
384
384
|
|
385
385
|
it "assigns the requested question as @question" do
|
386
|
-
put :update, :
|
386
|
+
put :update, id: @question.id, question: @attrs
|
387
387
|
assigns(:question).should eq(@question)
|
388
388
|
end
|
389
389
|
end
|
390
390
|
|
391
391
|
describe "with invalid params" do
|
392
392
|
it "assigns the requested question as @question" do
|
393
|
-
put :update, :
|
393
|
+
put :update, id: @question.id, question: @invalid_attrs
|
394
394
|
end
|
395
395
|
|
396
396
|
it "re-renders the 'edit' template" do
|
397
|
-
put :update, :
|
397
|
+
put :update, id: @question.id, question: @invalid_attrs
|
398
398
|
response.should render_template("edit")
|
399
399
|
end
|
400
400
|
end
|
401
401
|
|
402
402
|
it "should not update my question without body" do
|
403
|
-
put :update, :
|
403
|
+
put :update, id: 3, question: {body: ""}
|
404
404
|
assigns(:question).should_not be_valid
|
405
405
|
response.should be_success
|
406
406
|
end
|
407
407
|
|
408
408
|
it "should not update missing question" do
|
409
409
|
lambda{
|
410
|
-
put :update, :
|
410
|
+
put :update, id: 'missing', question: { }
|
411
411
|
}.should raise_error(ActiveRecord::RecordNotFound)
|
412
412
|
#response.should be_missing
|
413
413
|
end
|
@@ -418,11 +418,11 @@ describe QuestionsController do
|
|
418
418
|
|
419
419
|
describe "with valid params" do
|
420
420
|
it "updates the requested question" do
|
421
|
-
put :update, :
|
421
|
+
put :update, id: @question.id, question: @attrs
|
422
422
|
end
|
423
423
|
|
424
424
|
it "assigns the requested question as @question" do
|
425
|
-
put :update, :
|
425
|
+
put :update, id: @question.id, question: @attrs
|
426
426
|
assigns(:question).should eq(@question)
|
427
427
|
response.should redirect_to(@question)
|
428
428
|
end
|
@@ -430,12 +430,12 @@ describe QuestionsController do
|
|
430
430
|
|
431
431
|
describe "with invalid params" do
|
432
432
|
it "assigns the question as @question" do
|
433
|
-
put :update, :
|
433
|
+
put :update, id: @question.id, question: @invalid_attrs
|
434
434
|
assigns(:question).should_not be_valid
|
435
435
|
end
|
436
436
|
|
437
437
|
it "re-renders the 'edit' template" do
|
438
|
-
put :update, :
|
438
|
+
put :update, id: @question.id, question: @invalid_attrs
|
439
439
|
response.should render_template("edit")
|
440
440
|
end
|
441
441
|
end
|
@@ -446,11 +446,11 @@ describe QuestionsController do
|
|
446
446
|
|
447
447
|
describe "with valid params" do
|
448
448
|
it "updates the requested question" do
|
449
|
-
put :update, :
|
449
|
+
put :update, id: @question.id, question: @attrs
|
450
450
|
end
|
451
451
|
|
452
452
|
it "should be forbidden" do
|
453
|
-
put :update, :
|
453
|
+
put :update, id: @question.id, question: @attrs
|
454
454
|
assigns(:question).should eq(@question)
|
455
455
|
response.should be_forbidden
|
456
456
|
end
|
@@ -458,17 +458,17 @@ describe QuestionsController do
|
|
458
458
|
|
459
459
|
describe "with invalid params" do
|
460
460
|
it "assigns the question as @question" do
|
461
|
-
put :update, :
|
461
|
+
put :update, id: @question.id, question: @invalid_attrs
|
462
462
|
end
|
463
463
|
|
464
464
|
it "should be forbidden" do
|
465
|
-
put :update, :
|
465
|
+
put :update, id: @question.id, question: @invalid_attrs
|
466
466
|
response.should be_forbidden
|
467
467
|
end
|
468
468
|
end
|
469
469
|
|
470
470
|
it "should update my question" do
|
471
|
-
put :update, :
|
471
|
+
put :update, id: 3, question: {body: 'test'}
|
472
472
|
assigns(:question).should eq Question.find(3)
|
473
473
|
response.should redirect_to(assigns(:question))
|
474
474
|
end
|
@@ -477,18 +477,18 @@ describe QuestionsController do
|
|
477
477
|
describe "When not logged in" do
|
478
478
|
describe "with valid params" do
|
479
479
|
it "updates the requested question" do
|
480
|
-
put :update, :
|
480
|
+
put :update, id: @question.id, question: @attrs
|
481
481
|
end
|
482
482
|
|
483
483
|
it "should be forbidden" do
|
484
|
-
put :update, :
|
484
|
+
put :update, id: @question.id, question: @attrs
|
485
485
|
response.should redirect_to(new_user_session_url)
|
486
486
|
end
|
487
487
|
end
|
488
488
|
|
489
489
|
describe "with invalid params" do
|
490
490
|
it "assigns the requested question as @question" do
|
491
|
-
put :update, :
|
491
|
+
put :update, id: @question.id, question: @invalid_attrs
|
492
492
|
response.should redirect_to(new_user_session_url)
|
493
493
|
end
|
494
494
|
end
|
@@ -504,17 +504,17 @@ describe QuestionsController do
|
|
504
504
|
login_fixture_admin
|
505
505
|
|
506
506
|
it "destroys the requested question" do
|
507
|
-
delete :destroy, :
|
507
|
+
delete :destroy, id: @question.id
|
508
508
|
end
|
509
509
|
|
510
510
|
it "redirects to the questions list" do
|
511
|
-
delete :destroy, :
|
511
|
+
delete :destroy, id: @question.id
|
512
512
|
response.should redirect_to(user_questions_url(assigns(:question).user))
|
513
513
|
end
|
514
514
|
|
515
515
|
it "should not destroy missing question" do
|
516
516
|
lambda{
|
517
|
-
delete :destroy, :
|
517
|
+
delete :destroy, id: 'missing'
|
518
518
|
}.should raise_error(ActiveRecord::RecordNotFound)
|
519
519
|
#response.should be_missing
|
520
520
|
end
|
@@ -524,11 +524,11 @@ describe QuestionsController do
|
|
524
524
|
login_fixture_librarian
|
525
525
|
|
526
526
|
it "destroys the requested question" do
|
527
|
-
delete :destroy, :
|
527
|
+
delete :destroy, id: @question.id
|
528
528
|
end
|
529
529
|
|
530
530
|
it "redirects to the questions list" do
|
531
|
-
delete :destroy, :
|
531
|
+
delete :destroy, id: @question.id
|
532
532
|
response.should redirect_to(user_questions_url(assigns(:question).user))
|
533
533
|
end
|
534
534
|
end
|
@@ -537,32 +537,32 @@ describe QuestionsController do
|
|
537
537
|
login_fixture_user
|
538
538
|
|
539
539
|
it "destroys the requested question" do
|
540
|
-
delete :destroy, :
|
540
|
+
delete :destroy, id: @question.id
|
541
541
|
end
|
542
542
|
|
543
543
|
it "should be forbidden" do
|
544
|
-
delete :destroy, :
|
544
|
+
delete :destroy, id: @question.id
|
545
545
|
response.should be_forbidden
|
546
546
|
end
|
547
547
|
|
548
548
|
it "should destroy my question" do
|
549
|
-
delete :destroy, :
|
549
|
+
delete :destroy, id: 3
|
550
550
|
response.should redirect_to user_questions_url(assigns(:question).user)
|
551
551
|
end
|
552
552
|
|
553
553
|
it "should not destroy other question" do
|
554
|
-
delete :destroy, :
|
554
|
+
delete :destroy, id: 5
|
555
555
|
response.should be_forbidden
|
556
556
|
end
|
557
557
|
end
|
558
558
|
|
559
559
|
describe "When not logged in" do
|
560
560
|
it "destroys the requested question" do
|
561
|
-
delete :destroy, :
|
561
|
+
delete :destroy, id: @question.id
|
562
562
|
end
|
563
563
|
|
564
564
|
it "should be forbidden" do
|
565
|
-
delete :destroy, :
|
565
|
+
delete :destroy, id: @question.id
|
566
566
|
response.should redirect_to(new_user_session_url)
|
567
567
|
end
|
568
568
|
end
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
data/spec/fixtures/users.yml
CHANGED