Skip to content

Commit

Permalink
Add trace ability tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Sep 1, 2023
1 parent bd5eccf commit 11efe66
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/abilities/abilities_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,30 @@ class UserAbilityTest < AbilityTest
assert ability.cannot?(action, Issue), "should not be able to #{action} Issues"
end
end

test "Trace permissions" do
ability = Ability.new create(:user)

[:mine, :new, :create, :edit, :update, :destroy].each do |action|
assert ability.can?(action, Trace), "should be able to #{action} Trace"
end
end
end

class BlockedUserAbilityTest < AbilityTest
test "Trace permissions" do
user = create(:user)
create(:user_block, :needs_view, :user => user, :ends_at => Time.now.utc)
ability = Ability.new user

[:mine].each do |action|
assert ability.can?(action, Trace), "should be able to #{action} Trace"
end

[:new, :create, :edit, :update, :destroy].each do |action|
assert ability.cannot?(action, Trace), "should not be able to #{action} Trace"
end
end
end

class ModeratorAbilityTest < AbilityTest
Expand Down

0 comments on commit 11efe66

Please sign in to comment.