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

@@ -3,10 +3,9 @@ require 'test_helper'
class CommentVotesControllerTest < ActionController::TestCase
context "A comment votes controller" do
setup do
CurrentUser.user = Factory.create(:user)
CurrentUser.user = @user = Factory.create(:user)
CurrentUser.ip_addr = "127.0.0.1"
@comment = Factory.create(:comment)
@user = Factory.create(:user)
end
teardown do
@@ -16,9 +15,15 @@ class CommentVotesControllerTest < ActionController::TestCase
should "create a vote" do
assert_difference("CommentVote.count", 1) do
post :create, {:format => "js", :comment_id => @comment.id}, {:user_id => @user.id}
post :create, {:format => "js", :comment_id => @comment.id, :score => 1}, {:user_id => @user.id}
assert_response :success
end
end
should "fail silently on errors" do
Factory.create(:comment_vote, :comment => @comment)
post :create, {:format => "js", :comment_id => @comment.id, :score => 1}, {:user_id => @user.id}
assert_response :error
end
end
end