fixed comment vote functional test

This commit is contained in:
albert
2011-04-01 19:01:17 -04:00
parent e7748e1fc9
commit cbd877d020
43 changed files with 135 additions and 20369 deletions

View File

@@ -5,7 +5,8 @@ class CommentsControllerTest < ActionController::TestCase
setup do
CurrentUser.user = Factory.create(:user)
CurrentUser.ip_addr = "127.0.0.1"
@comment = Factory.create(:comment)
@post = Factory.create(:post)
@comment = Factory.create(:comment, :post => @post)
@user = Factory.create(:moderator_user)
end
@@ -29,15 +30,11 @@ class CommentsControllerTest < ActionController::TestCase
context "update action" do
should "update the comment" do
post :update, {:id => @comment.id, :comment => {:body => "abc"}}, {:user_id => @comment.creator_id}
assert_redirected_to comment_path(@comment)
assert_redirected_to post_path(@comment.post)
end
end
context "create action"do
setup do
@post = Factory.create(:post)
end
should "create a comment" do
assert_difference("Comment.count", 1) do
post :create, {:comment => Factory.attributes_for(:comment, :post_id => @post.id)}, {:user_id => @user.id}