Commit 8fc42807 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'sk/333828-fix-edit-policy' into 'master'

Add constraint to id param for ThreatMonitoringController

See merge request gitlab-org/gitlab!65307
parents 362e10df 0923ca06
......@@ -41,7 +41,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
resource :threat_monitoring, only: [:show], controller: :threat_monitoring do
get '/alerts/:iid', action: 'alert_details', constraints: { iid: /\d+/ }, as: :threat_monitoring_alert
resources :policies, only: [:new, :edit], controller: :threat_monitoring
resources :policies, only: [:new, :edit], controller: :threat_monitoring, constraints: { id: %r{[^/]+} }
end
resources :protected_environments, only: [:create, :update, :destroy], constraints: { id: /\d+/ } do
......
......@@ -70,4 +70,16 @@ RSpec.describe 'EE-specific project routing' do
expect(get('/gitlab/gitlabhq/-/security/policy')).to route_to('projects/security/policies#show', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
end
describe Projects::ThreatMonitoringController, 'routing' do
where(:id) do
%w[test.1.2 test-policy test:policy]
end
with_them do
it "to #edit" do
expect(get("/gitlab/gitlabhq/-/threat_monitoring/policies/#{id}/edit")).to route_to('projects/threat_monitoring#edit', namespace_id: 'gitlab', project_id: 'gitlabhq', id: id)
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment