Skip to content

Commit

Permalink
Adding missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
caiosba committed Oct 27, 2023
1 parent ba5ef8e commit 34e6306
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/models/ability_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1305,4 +1305,34 @@ def teardown
assert ability.cannot?(:destroy, fi2)
end
end

test "permissions for feed team" do
t1 = create_team
t2 = create_team
t3 = create_team
u1 = create_user
u2 = create_user
u3 = create_user
create_team_user user: u1, team: t1, role: 'admin'
create_team_user user: u2, team: t2, role: 'admin'
create_team_user user: u3, team: t3, role: 'admin'
f = create_feed team: t1
ft2 = create_feed_team feed: f, team: t2
ft3 = create_feed_team feed: f, team: t3
with_current_user_and_team(u1, t1) do
ability = Ability.new
assert ability.can?(:destroy, ft2)
assert ability.can?(:destroy, ft3)
end
with_current_user_and_team(u2, t2) do
ability = Ability.new
assert ability.can?(:destroy, ft2)
assert ability.cannot?(:destroy, ft3)
end
with_current_user_and_team(u3, t3) do
ability = Ability.new
assert ability.cannot?(:destroy, ft2)
assert ability.can?(:destroy, ft3)
end
end
end

0 comments on commit 34e6306

Please sign in to comment.