Skip to content
Browse files

clean up test

  • Loading branch information...
1 parent ad2489f commit 61ded10b9a763ff46086b51db65125a848635a2e @ruseel committed
Showing with 5 additions and 19 deletions.
  1. +5 −19 test/functional/comments_controller_test.rb
View
24 test/functional/comments_controller_test.rb
@@ -4,28 +4,15 @@ class CommentsControllerTest < ActionController::TestCase
setup do
@comment = comments(:one)
@topic = topics(:one)
- # @comment.topic = @topic
- # @comment.save
end
- # test "should get index" do
- # get :index
- # assert_response :success
- # assert_not_nil assigns(:comments)
- # end
-
test "should show" do
get :show, id: @comment
assert_response :success
assert_not_nil assigns(:comment)
end
- # test "should get new" do
- # get :new
- # assert_response :success
- # end
-
- test "should get create" do
+ test "should create comment" do
assert_difference('Comment.count', 1) do
post :create, comment: { body: "comment" }, topic_id: @topic
end
@@ -33,7 +20,7 @@ class CommentsControllerTest < ActionController::TestCase
assert_redirected_to @topic
end
- test "error message for empty body" do
+ test "should show flash for empty body" do
post :create, comment: {}, topic_id: @topic
assert_equal "empty body", flash[:notice]
end
@@ -43,16 +30,15 @@ class CommentsControllerTest < ActionController::TestCase
assert_response :success
end
- test "should get update" do
- put :update, id: @comment, comment: { body: "updated" }
+ test "should update comment" do
+ put :update, id: @comment, comment: { body: @comment.body }
assert_redirected_to @topic
end
- test "should get destroy" do
+ test "should destroy comment" do
assert_difference('Comment.count', -1) do
delete :destroy, id: @comment
end
assert_redirected_to @topic
end
-
end

0 comments on commit 61ded10

Please sign in to comment.
Something went wrong with that request. Please try again.