Commit 9b7e934c authored by Ryan Cobb's avatar Ryan Cobb

Allow dashboard paths in route

parent f2019576
c4a8f7e42201fe775340d0ace9316657
\ No newline at end of file
......@@ -25,7 +25,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
# Use this scope for all new project routes.
scope '-' do
get 'archive/*id', constraints: { format: Gitlab::PathRegex.archive_formats_regex, id: /.+?/ }, to: 'repositories#archive', as: 'archive'
get 'd', to: 'metrics_dashboard#metrics_dashboard_page', as: :metrics_dashboard_page
get 'd(/:dashboard_path)', constraints: { dashboard_path: /.+\.yml/ },
to: 'metrics_dashboard#metrics_dashboard_page', as: :metrics_dashboard_page, format: false
resources :artifacts, only: [:index, :destroy]
......
......@@ -49,12 +49,12 @@ describe 'metrics dashboard page' do
let(:dashboard_path) { '.gitlab/dashboards/dashboard_path.yml' }
it 'returns 200' do
send_request(dashboard: dashboard_path)
send_request(dashboard_path: dashboard_path)
expect(response).to have_gitlab_http_status(:ok)
end
it 'assigns environment0' do
send_request(dashboard: dashboard_path)
send_request(dashboard_path: dashboard_path)
expect(assigns(:environment).id).to eq(environment.id)
end
end
......@@ -63,18 +63,18 @@ describe 'metrics dashboard page' do
let(:dashboard_path) { '.gitlab/dashboards/dashboard_path.yml' }
it 'returns 200' do
send_request(dahboard: dashboard_path, environment: environment.id)
send_request(dahboard_path: dashboard_path, environment: environment.id)
expect(response).to have_gitlab_http_status(:ok)
end
it 'assigns query param environment' do
send_request(dashboard: dashboard_path, environment: environment2.id)
send_request(dashboard_path: dashboard_path, environment: environment2.id)
expect(assigns(:environment).id).to eq(environment2.id)
end
context 'when query param environment does not exist' do
it 'responds with 404' do
send_request(dashboard: dashboard_path, environment: 99)
send_request(dashboard_path: dashboard_path, environment: 99)
expect(response).to have_gitlab_http_status(:not_found)
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