From: Andy Allan Date: Wed, 31 Oct 2018 10:41:32 +0000 (+0100) Subject: Add testing for moderator users and issues X-Git-Tag: live~3375^2~2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/41619593df7cf3e1751e06cc9285f911b6e91e11?ds=inline;hp=--cc Add testing for moderator users and issues --- 41619593df7cf3e1751e06cc9285f911b6e91e11 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