X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/017f7da76f3d59a71c3cca481e0d3a20afe1c046..3d3b2b47964ec91ef1ab1946b7258a06665caced:/test/abilities/api_abilities_test.rb diff --git a/test/abilities/api_abilities_test.rb b/test/abilities/api_abilities_test.rb index a68704f1a..38154174c 100644 --- a/test/abilities/api_abilities_test.rb +++ b/test/abilities/api_abilities_test.rb @@ -7,7 +7,8 @@ end class GuestApiAbilityTest < ApiAbilityTest test "note permissions for a guest" do - ability = ApiAbility.new nil + scopes = Set.new + ability = ApiAbility.new nil, scopes [:index, :create, :feed, :show, :search].each do |action| assert ability.can?(action, Note), "should be able to #{action} Notes" @@ -21,8 +22,9 @@ end class UserApiAbilityTest < ApiAbilityTest test "Note permissions" do - token = create(:oauth_access_token, :scopes => %w[write_notes]) - ability = ApiAbility.new token + user = create(:user) + scopes = Set.new %w[write_notes] + ability = ApiAbility.new user, scopes [:index, :create, :comment, :feed, :show, :search, :close, :reopen].each do |action| assert ability.can?(action, Note), "should be able to #{action} Notes" @@ -36,8 +38,9 @@ end class ModeratorApiAbilityTest < ApiAbilityTest test "Note permissions" do - token = create(:oauth_access_token, :scopes => %w[write_notes], :resource_owner_id => create(:moderator_user).id) - ability = ApiAbility.new token + user = create(:moderator_user) + scopes = Set.new %w[write_notes] + ability = ApiAbility.new user, scopes [:index, :create, :comment, :feed, :show, :search, :close, :reopen, :destroy].each do |action| assert ability.can?(action, Note), "should be able to #{action} Notes"