Commit bd1697d3ac719b79a775a4480a38d96145873942
1 parent
0490f6b7
Exists in
master
and in
1 other branch
add test for bug in sessions_with_vote
Showing
1 changed file
with
15 additions
and
0 deletions
Show diff stats
spec/models/question_spec.rb
| @@ -353,6 +353,21 @@ describe Question do | @@ -353,6 +353,21 @@ describe Question do | ||
| 353 | end | 353 | end |
| 354 | end | 354 | end |
| 355 | 355 | ||
| 356 | + context "sessions_with_vote" do | ||
| 357 | + before(:all) do | ||
| 358 | + truncate_all | ||
| 359 | + @q1 = Factory.create(:aoi_question) | ||
| 360 | + @q2 = Factory.create(:aoi_question) | ||
| 361 | + end | ||
| 362 | + | ||
| 363 | + it "should not count sessions for another question" do | ||
| 364 | + Factory.create(:vote, :question => @q1) | ||
| 365 | + appearance = Factory.create(:appearance_new_user, :question => @q1) | ||
| 366 | + Factory.create(:vote_new_user, :question => @q2, :voter => appearance.voter) | ||
| 367 | + @q1.sessions_with_vote.should == 1 | ||
| 368 | + end | ||
| 369 | + | ||
| 370 | + end | ||
| 356 | context "vote rate" do | 371 | context "vote rate" do |
| 357 | before(:all) do | 372 | before(:all) do |
| 358 | truncate_all | 373 | truncate_all |