Generated scaffolding for model via Rails

This commit is contained in:
Prelang Builder
2014-02-27 23:58:57 +00:00
committed by u7482
parent 9921d3b6d6
commit aec5ca5c47
14 changed files with 209 additions and 0 deletions
@@ -0,0 +1,49 @@
require 'test_helper'
class QuestionsControllerTest < ActionController::TestCase
setup do
@question = questions(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:questions)
end
test "should get new" do
get :new
assert_response :success
end
test "should create question" do
assert_difference('Question.count') do
post :create, question: { title: @question.title }
end
assert_redirected_to question_path(assigns(:question))
end
test "should show question" do
get :show, id: @question
assert_response :success
end
test "should get edit" do
get :edit, id: @question
assert_response :success
end
test "should update question" do
patch :update, id: @question, question: { title: @question.title }
assert_redirected_to question_path(assigns(:question))
end
test "should destroy question" do
assert_difference('Question.count', -1) do
delete :destroy, id: @question
end
assert_redirected_to questions_path
end
end
+4
View File
@@ -0,0 +1,4 @@
require 'test_helper'
class QuestionsHelperTest < ActionView::TestCase
end