gitlab-org--gitlab-foss/spec/routing/uploads_routing_spec.rb
Sean McGivern c1892f6c90 Remove the comment_personal_snippet permission
This is now entirely handled by `create_note`:

1. Project snippets prevent `create_note`.
2. Uploads already only support routing for personal snippets.

This simplifies some policies and access checks, too!
2019-05-02 11:13:42 +01:00

22 lines
570 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
describe 'Uploads', 'routing' do
it 'allows creating uploads for personal snippets' do
expect(post('/uploads/personal_snippet?id=1')).to route_to(
controller: 'uploads',
action: 'create',
model: 'personal_snippet',
id: '1'
)
end
it 'does not allow creating uploads for other models' do
UploadsController::MODEL_CLASSES.keys.compact.each do |model|
next if model == 'personal_snippet'
expect(post("/uploads/#{model}?id=1")).not_to be_routable
end
end
end