Skip to content

Commit

Permalink
hide has many tab by policy
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob committed Jul 5, 2023
1 parent 486c3e1 commit 2cd9675
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/system/avo/tabs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,22 @@
end
end
end

it "hides has_many tab header button by policy" do
visit avo.resources_user_path user

expect(page).to have_selector("a.button-component[data-tabs-id-param='Teams']", text: "Teams")

UserPolicy.define_method(:view_teams?) do
false
end

visit avo.resources_user_path user

expect(page).to have_no_selector("a.button-component[data-tabs-id-param='Teams']", text: "Teams")

UserPolicy.remove_method(:view_teams?)
end
end

context "edit" do
Expand Down

0 comments on commit 2cd9675

Please sign in to comment.