add tests for #1263

This commit is contained in:
Toks
2013-06-29 15:10:09 -04:00
parent badc3122f0
commit 8c7fa25a5d
2 changed files with 25 additions and 0 deletions

View File

@@ -1138,6 +1138,18 @@ class PostTest < ActiveSupport::TestCase
assert_equal(1, post.score)
end
end
should "allow undoing of votes" do
user = FactoryGirl.create(:user)
post = FactoryGirl.create(:post)
CurrentUser.scoped(user, "127.0.0.1") do
post.vote!("up")
post.unvote!
post.reload
assert_equal(0, post.score)
assert_nothing_raised {post.vote!("down")}
end
end
end
context "Counting:" do