]> git.openstreetmap.org Git - rails.git/blob - test/abilities/guest_api_ability_test.rb
Merge remote-tracking branch 'upstream/pull/6787'
[rails.git] / test / abilities / guest_api_ability_test.rb
1 # frozen_string_literal: true
2
3 require "test_helper"
4
5 class GuestApiAbilityTest < ActiveSupport::TestCase
6   test "note permissions for a guest" do
7     scopes = Set.new
8     ability = ApiAbility.new nil, scopes
9
10     [:index, :create, :feed, :show, :search].each do |action|
11       assert ability.can?(action, Note), "should be able to #{action} Notes"
12     end
13
14     [:comment, :close, :reopen, :destroy].each do |action|
15       assert ability.cannot?(action, Note), "should not be able to #{action} Notes"
16     end
17   end
18 end