fix comment votes affecting comment updater_id

This commit is contained in:
albert
2013-03-18 16:03:29 -07:00
parent 6c0dd832a5
commit 922ccabe1d
2 changed files with 15 additions and 4 deletions

View File

@@ -73,6 +73,17 @@ class CommentTest < ActiveSupport::TestCase
assert_equal(c1.created_at.to_s, p.last_commented_at.to_s)
end
should "not record the user id of the voter" do
user = FactoryGirl.create(:user)
post = FactoryGirl.create(:post)
c1 = FactoryGirl.create(:comment, :post => post)
CurrentUser.scoped(user, "127.0.0.1") do
c1.vote!("up")
c1.reload
assert_not_equal(user.id, c1.updater_id)
end
end
should "not allow duplicate votes" do
user = FactoryGirl.create(:user)
post = FactoryGirl.create(:post)