add tests case for #1555

This commit is contained in:
r888888888
2013-05-31 16:04:41 -07:00
parent 6600cdc0f1
commit ce8c5204e3

View File

@@ -22,6 +22,14 @@ class PostVotesControllerTest < ActionController::TestCase
assert_equal(1, @post.score)
end
context "that fails" do
should "return a 500" do
post :create, {:post_id => @post.id, :score => "up", :format => "json"}, {:user_id => @user.id}
post :create, {:post_id => @post.id, :score => "up", :format => "json"}, {:user_id => @user.id}
assert_equal("{\"success\": false, \"reason\": \"You have already voted for this post\"}", response.body.strip)
end
end
context "for a post that has already been voted on" do
setup do
@post.vote!("up")