aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'site/spec/models/agenda_spec.rb')
-rw-r--r--site/spec/models/agenda_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/site/spec/models/agenda_spec.rb b/site/spec/models/agenda_spec.rb
index 00165d1..b9e564c 100644
--- a/site/spec/models/agenda_spec.rb
+++ b/site/spec/models/agenda_spec.rb
@@ -23,6 +23,20 @@ describe Agenda do
end
end
+ it 'should allow everybody to view summaries after 4 council members approved it' do
+ agenda = Agenda.current
+
+ for u in users_factory(:guest, :user, :admin)
+ agenda.should_not be_viewable_by(u, :summary)
+ end
+
+ (1..4).each { |i| Factory(:approval, :agenda => agenda) }
+
+ for u in users_factory(AllRoles)
+ agenda.should be_viewable_by(u, :summary)
+ end
+ end
+
it 'should allow only administrators and council members to edit and update' do
a = Factory(:agenda)
for u in users_factory(:guest, :user)
@@ -310,4 +324,12 @@ describe Agenda do
VotingOption.last.description.should == 'new option'
end
end
+
+ it 'should remove approvals for summary, when summary changes' do
+ agenda = Agenda.current
+ Factory(:approval, :agenda => agenda)
+ agenda.summary = 'changed'
+ agenda.save!
+ Approval.count.should be_zero
+ end
end