aboutsummaryrefslogtreecommitdiff
path: root/site
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-07-19 21:34:26 +0200
committerPetteri R├Ąty <petsku@petteriraty.eu>2011-07-21 19:01:49 +0300
commit37250116be03b7596b4a047358a204d686ff448c (patch)
tree07034a247455b96ffe5128f019435c07083124c5 /site
parentMerge remote-tracking branch 'github/seed' (diff)
downloadcouncil-webapp-37250116be03b7596b4a047358a204d686ff448c.tar.gz
council-webapp-37250116be03b7596b4a047358a204d686ff448c.tar.bz2
council-webapp-37250116be03b7596b4a047358a204d686ff448c.zip
Improve tests coverage
Diffstat (limited to 'site')
-rw-r--r--site/spec/models/voting_option_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/site/spec/models/voting_option_spec.rb b/site/spec/models/voting_option_spec.rb
index 2b6005c..87074c6 100644
--- a/site/spec/models/voting_option_spec.rb
+++ b/site/spec/models/voting_option_spec.rb
@@ -45,4 +45,14 @@ describe VotingOption do
v.should be_viewable_by(u)
end
end
+
+ it 'should return proper community votes count' do
+ item = Factory(:agenda_item)
+ option_a = Factory(:voting_option, :agenda_item => item, :description => 'a')
+ option_b = Factory(:voting_option, :agenda_item => item, :description => 'b')
+ (1..3).each { |i| Factory(:vote, :council_vote => false, :voting_option => option_a) }
+ (1..7).each { |i| Factory(:vote, :council_vote => false, :voting_option => option_b) }
+ option_a.community_votes.should == '3 of 10 (30%) votes.'
+ option_b.community_votes.should == '7 of 10 (70%) votes.'
+ end
end