diff options
author | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2011-06-29 18:54:05 +0200 |
---|---|---|
committer | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2011-07-06 16:47:33 +0200 |
commit | 93aa447e40d59bd978581e11fd60ae4c668caa4c (patch) | |
tree | bc8c4ecece5b531ada0c7410eada855a2be8aab1 /site/spec | |
parent | Update selenium-webdriver (diff) | |
download | council-webapp-93aa447e40d59bd978581e11fd60ae4c668caa4c.tar.gz council-webapp-93aa447e40d59bd978581e11fd60ae4c668caa4c.tar.bz2 council-webapp-93aa447e40d59bd978581e11fd60ae4c668caa4c.zip |
Allow all users to vote
Diffstat (limited to 'site/spec')
-rw-r--r-- | site/spec/models/vote_spec.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/site/spec/models/vote_spec.rb b/site/spec/models/vote_spec.rb index 9936829..aa9f2e8 100644 --- a/site/spec/models/vote_spec.rb +++ b/site/spec/models/vote_spec.rb @@ -1,7 +1,16 @@ require 'spec_helper' describe Vote do - it 'should not allow anyone to create update or destroy to anyone' do + it 'should allow anyone to create, update and destroy their own votes' do + for u in users_factory(AllRoles - [:guest]) do + vote = Factory(:vote, :user => u) + vote.should be_creatable_by(u) + vote.should be_updatable_by(u) + vote.should be_destroyable_by(u) + end + end + + it 'should not allow anyone to create, update and destroy vote of someone else' do vote = Factory(:vote) for u in users_factory(AllRoles) do vote.should_not be_creatable_by(u) @@ -10,25 +19,19 @@ describe Vote do end end - it 'should anyone to view' do + it 'should allow anyone to view' do vote = Factory(:vote) for u in users_factory(AllRoles) do vote.should be_viewable_by(u) end end - it 'should allow council members to vote' do - for u in users_factory(:council, :council_admin) do + it 'should allow all users to vote' do + for u in users_factory(AllRoles - [:guest]) do Vote.new(:user => u, :voting_option => Factory(:voting_option)).should be_valid end end - it 'should prevent non-council members from voting' do - for u in users_factory(:user, :admin) do - Vote.new(:user => u, :voting_option => Factory(:voting_option)).should_not be_valid - end - end - it 'should prevent users from voting multiple times' do v = Factory(:vote) o = Factory(:voting_option, :agenda_item => v.voting_option.agenda_item, :description => 'other option') |