aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-06-24 15:07:46 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-06-25 19:39:42 +0200
commitc2634a954af3c5e0cc99eb53f33eb73b03c70bd5 (patch)
treed2817245d97eb1bcf321d57dd3cdea1d8c11a3d2 /spec
parentRewrite seed to make it cleaner (diff)
downloadrecruiting-webapp-c2634a954af3c5e0cc99eb53f33eb73b03c70bd5.tar.gz
recruiting-webapp-c2634a954af3c5e0cc99eb53f33eb73b03c70bd5.tar.bz2
recruiting-webapp-c2634a954af3c5e0cc99eb53f33eb73b03c70bd5.zip
Users can list their contributions, mentors can find for recruits with no mentor
Diffstat (limited to 'spec')
-rw-r--r--spec/models/user_category_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/models/user_category_spec.rb b/spec/models/user_category_spec.rb
index 0ed258c..b61f3eb 100644
--- a/spec/models/user_category_spec.rb
+++ b/spec/models/user_category_spec.rb
@@ -34,4 +34,33 @@ describe UserCategory do
it "should deny other users to CUD, edit and view user categories" do
deny_all(fabricate_users(:recruit, :mentor) + [Guest.new], Factory(:user_category))
end
+
+ it "should allow everybody to view contributons" do
+ for u in fabricate_all_roles + [Guest.new]
+ Factory(:recruit).should be_viewable_by(u, :contributions)
+ end
+ end
+
+ it "should allow to edit and update users own contributons" do
+ recruit = Factory(:recruit)
+ recruit.should be_editable_by(recruit, :contributions)
+ recruit.contributions = "changed"
+ recruit.should be_updatable_by(recruit)
+ end
+
+ it "should allow admins to edit and update users contributons" do
+ recruit = Factory(:recruit)
+ recruit.should be_editable_by(Factory(:administrator), :contributions)
+ recruit.contributions = "changed"
+ recruit.should be_updatable_by(Factory(:administrator))
+ end
+
+ it "should prohibit non-admins to edit and update someone else contributons" do
+ recruit = Factory(:recruit)
+ for u in fabricate_users(:recruit, :mentor, :recruiter) + [Guest.new]
+ recruit.should_not be_editable_by(u, :contributions)
+ recruit.contributions = "changed"
+ recruit.should_not be_updatable_by(u)
+ end
+ end
end