X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/175bb0d00678b370bc79fabec3a0334683c3f022..304e0ef63843ddcb55aab62312ff18be8a5b4703:/test/abilities/api_abilities_test.rb diff --git a/test/abilities/api_abilities_test.rb b/test/abilities/api_abilities_test.rb index a68704f1a..c32300c60 100644 --- a/test/abilities/api_abilities_test.rb +++ b/test/abilities/api_abilities_test.rb @@ -7,7 +7,7 @@ end class GuestApiAbilityTest < ApiAbilityTest test "note permissions for a guest" do - ability = ApiAbility.new nil + ability = ApiAbility.new nil, nil [:index, :create, :feed, :show, :search].each do |action| assert ability.can?(action, Note), "should be able to #{action} Notes" @@ -21,8 +21,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) + token = create(:oauth_access_token, :user => user, :scopes => %w[write_notes]) + ability = ApiAbility.new user, token [:index, :create, :comment, :feed, :show, :search, :close, :reopen].each do |action| assert ability.can?(action, Note), "should be able to #{action} Notes" @@ -36,8 +37,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) + token = create(:oauth_access_token, :user => user, :scopes => %w[write_notes]) + ability = ApiAbility.new user, token [:index, :create, :comment, :feed, :show, :search, :close, :reopen, :destroy].each do |action| assert ability.can?(action, Note), "should be able to #{action} Notes"