aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/agendas.yml18
-rw-r--r--spec/models/agenda_spec.rb27
2 files changed, 45 insertions, 0 deletions
diff --git a/spec/fixtures/agendas.yml b/spec/fixtures/agendas.yml
new file mode 100644
index 0000000..141c7cb
--- /dev/null
+++ b/spec/fixtures/agendas.yml
@@ -0,0 +1,18 @@
+agenda_one:
+ name: Go to the Zoo
+ description: Disneyland
+ start_at: <%= 15.days.from_now %>
+ end_at: <%= 16.days.from_now %>
+ owner: council_member
+agenda_two:
+ name: hosting a party
+ description: HIT
+ start_at: <%= 15.days.from_now %>
+ end_at: <%= 16.days.from_now %>
+ owner: council_member
+agenda_test_name:
+ name: agenda_test_name
+ description: agenda_test_description
+ start_at: <%= 15.days.from_now %>
+ end_at: <%= 16.days.from_now %>
+ owner: council_member
diff --git a/spec/models/agenda_spec.rb b/spec/models/agenda_spec.rb
new file mode 100644
index 0000000..56f866b
--- /dev/null
+++ b/spec/models/agenda_spec.rb
@@ -0,0 +1,27 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe Agenda do
+ before(:each) do
+ @agenda = agendas(:agenda_one)
+ end
+
+ it "should allow guest to view" do
+ @agenda.should be_viewable_by(users(:guest))
+ end
+
+ it "should allow council member to create" do
+ Agenda.new(
+ :name => 'agenda3',
+ :description => 'agenda 3'
+ ).should be_creatable_by(users(:council_member))
+ end
+
+ it "should not allow guest to update" do
+ @agenda.should_not be_updatable_by(users(:guest))
+ end
+
+ it "should allow council member to edit" do
+ agenda = agendas(:agenda_one)
+ agenda.should be_updatable_by(users(:council_member))
+ end
+end