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~2784^2~2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/41619593df7cf3e1751e06cc9285f911b6e91e11?hp=149c07fd2bc33a8974d0b0f6e8ab5425d3178374 Add testing for moderator users and issues --- 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