From bd1697d3ac719b79a775a4480a38d96145873942 Mon Sep 17 00:00:00 2001 From: Luke Baker Date: Wed, 7 Nov 2012 10:16:43 -0500 Subject: [PATCH] add test for bug in sessions_with_vote --- spec/models/question_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+), 0 deletions(-) diff --git a/spec/models/question_spec.rb b/spec/models/question_spec.rb index 9069d61..ff5507a 100644 --- a/spec/models/question_spec.rb +++ b/spec/models/question_spec.rb @@ -353,6 +353,21 @@ describe Question do end end + context "sessions_with_vote" do + before(:all) do + truncate_all + @q1 = Factory.create(:aoi_question) + @q2 = Factory.create(:aoi_question) + end + + it "should not count sessions for another question" do + Factory.create(:vote, :question => @q1) + appearance = Factory.create(:appearance_new_user, :question => @q1) + Factory.create(:vote_new_user, :question => @q2, :voter => appearance.voter) + @q1.sessions_with_vote.should == 1 + end + + end context "vote rate" do before(:all) do truncate_all -- libgit2 0.21.2