Commit c9a7145a authored by Tiago Botelho's avatar Tiago Botelho

Remove GET empty from EnvironmentsController

parent dd467d6c
......@@ -120,21 +120,14 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end
end
def empty
render :empty
end
def metrics_redirect
environment = project.environments.with_state(:available).first
path =
if environment
environment_metrics_path(environment)
redirect_to environment_metrics_path(environment)
else
empty_project_environments_path(project)
render :empty
end
redirect_to path
end
def metrics
......
......@@ -210,7 +210,7 @@
%li.divider.fly-out-top-item
- if project_nav_tab? :environments
= nav_link(controller: :environments, action: [:metrics, :empty]) do
= nav_link(controller: :environments, action: [:metrics, :metrics_redirect]) do
= link_to metrics_project_environments_path(@project), title: 'Metrics', class: 'shortcuts-metrics' do
%span
= _('Metrics')
......
......@@ -236,7 +236,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
collection do
get :metrics, action: :metrics_redirect
get :empty
get :folder, path: 'folders/*id', constraints: { format: /(html|json)/ }
end
......
......@@ -277,16 +277,6 @@ describe Projects::EnvironmentsController do
end
end
describe 'GET #empty' do
it 'responds with HTML' do
get :empty, namespace_id: project.namespace,
project_id: project
expect(response).to be_ok
expect(response).to render_template 'empty'
end
end
describe 'GET #metrics_redirect' do
let(:project) { create(:project) }
......@@ -301,7 +291,8 @@ describe Projects::EnvironmentsController do
it 'redirects to empty page if no environment exists' do
get :metrics_redirect, environment_params
expect(response).to redirect_to(empty_project_environments_path(project))
expect(response).to be_ok
expect(response).to render_template 'empty'
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