diff options
author | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2011-07-21 18:42:07 +0200 |
---|---|---|
committer | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2011-07-26 12:09:47 +0200 |
commit | 1a15725aad91a3b16928cb43f608379d6ade13e3 (patch) | |
tree | 1ffb09a673a40c47fae264f517cae57ab5fb658e /site/spec/models/approval_spec.rb | |
parent | Add summary field (diff) | |
download | council-webapp-1a15725aad91a3b16928cb43f608379d6ade13e3.tar.gz council-webapp-1a15725aad91a3b16928cb43f608379d6ade13e3.tar.bz2 council-webapp-1a15725aad91a3b16928cb43f608379d6ade13e3.zip |
Council members can approve summaries
Regular users can view summary only after 4 council members approve it.
When someone changes summary all approvals for that summary are deleted.
Diffstat (limited to 'site/spec/models/approval_spec.rb')
-rw-r--r-- | site/spec/models/approval_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/site/spec/models/approval_spec.rb b/site/spec/models/approval_spec.rb new file mode 100644 index 0000000..4057a6d --- /dev/null +++ b/site/spec/models/approval_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +describe Approval do + it 'should be viewable by everybody' do + approval = Factory(:approval) + for user in users_factory(AllRoles) + approval.should be_viewable_by(user) + end + end + + it 'only council members should be able to change it - and only for themselves' do + for user in users_factory(:council, :council_admin) + approval = Factory(:approval, :user => user) + approval.should be_creatable_by(user) + approval.should be_editable_by(user) + approval.should be_updatable_by(user) + approval.should be_destroyable_by(user) + end + + approval = Factory(:approval) + for user in users_factory(:council, :council_admin) + approval.should_not be_creatable_by(user) + approval.should_not be_editable_by(user) + approval.should_not be_updatable_by(user) + approval.should_not be_destroyable_by(user) + end + + for user in users_factory(:user, :admin) + approval = Approval.new :user => user, :agenda => Agenda.current + approval.should_not be_creatable_by(user) + approval.should_not be_editable_by(user) + approval.should_not be_updatable_by(user) + approval.should_not be_destroyable_by(user) + end + end +end |