1 # frozen_string_literal: true
5 class UserApiAbilityTest < ActiveSupport::TestCase
6 test "Note permissions" do
8 scopes = Set.new %w[write_notes]
9 ability = ApiAbility.new user, scopes
11 [:index, :create, :comment, :feed, :show, :search, :close, :reopen].each do |action|
12 assert ability.can?(action, Note), "should be able to #{action} Notes"
15 [:destroy].each do |action|
16 assert ability.cannot?(action, Note), "should not be able to #{action} Notes"