Enable missing before actions in Collection API (#37122)

This commit is contained in:
David Roetzel
2025-12-04 16:35:47 +01:00
committed by GitHub
parent 88aed3c11a
commit 75b9e9a8b0
2 changed files with 6 additions and 6 deletions

View File

@@ -9,9 +9,9 @@ class Api::V1Alpha::CollectionsController < Api::BaseController
before_action :check_feature_enabled
before_action -> { doorkeeper_authorize! :write, :'write:collections' }, only: [:create]
before_action -> { doorkeeper_authorize! :write, :'write:collections' }, only: [:create, :update, :destroy]
before_action :require_user!, only: [:create]
before_action :require_user!, only: [:create, :update, :destroy]
before_action :set_collection, only: [:show, :update, :destroy]

View File

@@ -104,8 +104,6 @@ RSpec.describe 'Api::V1Alpha::Collections', feature: :collections do
let(:collection) { Fabricate(:collection) }
let(:params) { {} }
it_behaves_like 'forbidden for wrong scope', 'read:collections'
context 'when user is not owner' do
it 'returns http forbidden' do
subject
@@ -124,6 +122,8 @@ RSpec.describe 'Api::V1Alpha::Collections', feature: :collections do
discoverable: false)
end
it_behaves_like 'forbidden for wrong scope', 'read:collections'
context 'with valid params' do
let(:params) do
{
@@ -172,8 +172,6 @@ RSpec.describe 'Api::V1Alpha::Collections', feature: :collections do
let(:collection) { Fabricate(:collection) }
it_behaves_like 'forbidden for wrong scope', 'read:collections'
context 'when user is not owner' do
it 'returns http forbidden' do
subject
@@ -185,6 +183,8 @@ RSpec.describe 'Api::V1Alpha::Collections', feature: :collections do
context 'when user is the owner' do
let(:collection) { Fabricate(:collection, account: user.account) }
it_behaves_like 'forbidden for wrong scope', 'read:collections'
it 'deletes the collection and returns http success' do
collection