Commit 373a13b2 authored by Stan Hu's avatar Stan Hu

Merge branch 'stop-using-view-helpers-in-clusterable-presenters' into 'master'

Stop using view helpers in ClusterablePresenter classes

See merge request gitlab-org/gitlab!71235
parents fbf0df62 b1f3ca44
......@@ -2591,10 +2591,7 @@ Rails/IncludeUrlHelper:
- 'app/presenters/ci/pipeline_presenter.rb'
- 'app/presenters/environment_presenter.rb'
- 'app/presenters/gitlab/blame_presenter.rb'
- 'app/presenters/group_clusterable_presenter.rb'
- 'app/presenters/instance_clusterable_presenter.rb'
- 'app/presenters/merge_request_presenter.rb'
- 'app/presenters/project_clusterable_presenter.rb'
- 'app/presenters/project_presenter.rb'
- 'app/presenters/prometheus_alert_presenter.rb'
- 'app/presenters/release_presenter.rb'
......
......@@ -2,7 +2,6 @@
class GroupClusterablePresenter < ClusterablePresenter
extend ::Gitlab::Utils::Override
include ActionView::Helpers::UrlHelper
presents ::Group
......@@ -33,7 +32,7 @@ class GroupClusterablePresenter < ClusterablePresenter
override :learn_more_link
def learn_more_link
link_to(s_('ClusterIntegration|Learn more about group Kubernetes clusters'), help_page_path('user/group/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about group Kubernetes clusters'), help_page_path('user/group/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
end
def metrics_dashboard_path(cluster)
......
......@@ -2,7 +2,6 @@
class InstanceClusterablePresenter < ClusterablePresenter
extend ::Gitlab::Utils::Override
include ActionView::Helpers::UrlHelper
presents ::Clusters::Instance
......@@ -71,7 +70,7 @@ class InstanceClusterablePresenter < ClusterablePresenter
override :learn_more_link
def learn_more_link
link_to(s_('ClusterIntegration|Learn more about instance Kubernetes clusters'), help_page_path('user/instance/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about instance Kubernetes clusters'), help_page_path('user/instance/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
end
def metrics_dashboard_path(cluster)
......
......@@ -2,7 +2,6 @@
class ProjectClusterablePresenter < ClusterablePresenter
extend ::Gitlab::Utils::Override
include ActionView::Helpers::UrlHelper
presents ::Project
......@@ -28,7 +27,7 @@ class ProjectClusterablePresenter < ClusterablePresenter
override :learn_more_link
def learn_more_link
link_to(s_('ClusterIntegration|Learn more about Kubernetes'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about Kubernetes'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
end
def metrics_dashboard_path(cluster)
......
......@@ -84,4 +84,10 @@ RSpec.describe GroupClusterablePresenter do
it { is_expected.to eq(metrics_dashboard_group_cluster_path(group, cluster)) }
end
describe '#learn_more_link' do
subject { presenter.learn_more_link }
it { is_expected.to include('user/group/clusters/index') }
end
end
......@@ -32,4 +32,10 @@ RSpec.describe InstanceClusterablePresenter do
it { is_expected.to eq(metrics_dashboard_admin_cluster_path(cluster)) }
end
describe '#learn_more_link' do
subject { presenter.learn_more_link }
it { is_expected.to include('user/instance/clusters/index') }
end
end
......@@ -84,4 +84,10 @@ RSpec.describe ProjectClusterablePresenter do
it { is_expected.to eq(metrics_dashboard_project_cluster_path(project, cluster)) }
end
describe '#learn_more_link' do
subject { presenter.learn_more_link }
it { is_expected.to include('user/project/clusters/index') }
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