From 41619593df7cf3e1751e06cc9285f911b6e91e11 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 31 Oct 2018 11:41:32 +0100 Subject: [PATCH] Add testing for moderator users and issues --- test/models/abilities_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/models/abilities_test.rb b/test/models/abilities_test.rb index 2bae4e88c..be0b61af8 100644 --- a/test/models/abilities_test.rb +++ b/test/models/abilities_test.rb @@ -40,6 +40,20 @@ class UserAbilityTest < AbilityTest assert ability.cannot?(action, DiaryEntry), "should be able to #{action} DiaryEntries" assert ability.cannot?(action, DiaryComment), "should be able to #{action} DiaryEntries" end + + [:index, :show, :resolve, :ignore, :reopen].each do |action| + assert ability.cannot?(action, Issue), "should not be able to #{action} Issues" + end + end +end + +class ModeratorAbilityTest < AbilityTest + test "Issue permissions" do + ability = Ability.new create(:moderator_user) + + [:index, :show, :resolve, :ignore, :reopen].each do |action| + assert ability.can?(action, Issue), "should be able to #{action} Issues" + end end end -- 2.43.2