summaryrefslogtreecommitdiff
path: root/spec/routing/uploads_routing_spec.rb
blob: 6a041ffdd6c4bccbecb02908c950b6cf576ba735 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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