aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-06-27 19:25:00 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-07-05 11:58:08 +0200
commit13007157d546151228f6a34f580c23aa853163c9 (patch)
treecbe38a64d774edd9c41d8fcbaecae0d008142591 /site/spec/models/agenda_spec.rb
parentApplication receives data from bot (diff)
downloadcouncil-webapp-13007157d546151228f6a34f580c23aa853163c9.tar.gz
council-webapp-13007157d546151228f6a34f580c23aa853163c9.tar.bz2
council-webapp-13007157d546151228f6a34f580c23aa853163c9.zip
Agenda.current creates new agenda if needed
Removed agenda initializer as it is no longer needed.
Diffstat (limited to 'site/spec/models/agenda_spec.rb')
-rw-r--r--site/spec/models/agenda_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/site/spec/models/agenda_spec.rb b/site/spec/models/agenda_spec.rb
index b84f462..05212d0 100644
--- a/site/spec/models/agenda_spec.rb
+++ b/site/spec/models/agenda_spec.rb
@@ -233,6 +233,18 @@ describe Agenda do
end
end
+ describe '#current?' do
+ it 'should create new agenda if needed' do
+ Agenda.count.should be_zero
+ agenda = Agenda.current
+ agenda2 = Agenda.current
+ agenda.should be_a(Agenda)
+ agenda2.should be_a(Agenda)
+ Agenda.count.should be_equal(1)
+ agenda.id.should be_equal(agenda2.id)
+ end
+ end
+
it 'should return proper voting_array' do
old_agenda = Factory(:agenda, :state => 'old')
current_agenda = Factory(:agenda)