summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2018-11-02 09:48:38 +1300
committerThong Kuah <tkuah@gitlab.com>2018-11-02 09:49:52 +1300
commit3e7d48317353b8e0ffb066643eb4ced2e9455aec (patch)
treedb16bf4e532e3f09e31f4f10ac9c48c8f6e79695
parent1a1fdf8efe1923ba781e978e858c009264020e72 (diff)
downloadgitlab-ce-3e7d48317353b8e0ffb066643eb4ced2e9455aec.tar.gz
Add missing specs for Presenter
Also add missing interface in abstract class.
-rw-r--r--app/presenters/clusterable_presenter.rb20
-rw-r--r--spec/presenters/project_clusterable_presenter_spec.rb33
2 files changed, 53 insertions, 0 deletions
diff --git a/app/presenters/clusterable_presenter.rb b/app/presenters/clusterable_presenter.rb
index c857d57b003..61e00b31185 100644
--- a/app/presenters/clusterable_presenter.rb
+++ b/app/presenters/clusterable_presenter.rb
@@ -27,4 +27,24 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated
def clusterable_params
raise NotImplementedError
end
+
+ def create_user_clusters_path
+ raise NotImplementedError
+ end
+
+ def create_gcp_clusters_path
+ raise NotImplementedError
+ end
+
+ def cluster_status_cluster_path(cluster, params = {})
+ raise NotImplementedError
+ end
+
+ def install_applications_cluster_path(cluster, application)
+ raise NotImplementedError
+ end
+
+ def cluster_path(cluster, params = {})
+ raise NotImplementedError
+ end
end
diff --git a/spec/presenters/project_clusterable_presenter_spec.rb b/spec/presenters/project_clusterable_presenter_spec.rb
index c9045f0175a..b12143146f9 100644
--- a/spec/presenters/project_clusterable_presenter_spec.rb
+++ b/spec/presenters/project_clusterable_presenter_spec.rb
@@ -7,6 +7,7 @@ describe ProjectClusterablePresenter do
let(:presenter) { described_class.new(project) }
let(:project) { create(:project) }
+ let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
describe '#can_create_cluster?' do
let(:user) { create(:user) }
@@ -42,6 +43,38 @@ describe ProjectClusterablePresenter do
it { is_expected.to eq(new_project_cluster_path(project)) }
end
+ describe '#create_user_clusters_path' do
+ subject { presenter.create_user_clusters_path }
+
+ it { is_expected.to eq(create_user_project_clusters_path(project)) }
+ end
+
+ describe '#create_gcp_clusters_path' do
+ subject { presenter.create_gcp_clusters_path }
+
+ it { is_expected.to eq(create_gcp_project_clusters_path(project)) }
+ end
+
+ describe '#cluster_status_cluster_path' do
+ subject { presenter.cluster_status_cluster_path(cluster) }
+
+ it { is_expected.to eq(cluster_status_project_cluster_path(project, cluster)) }
+ end
+
+ describe '#install_applications_cluster_path' do
+ let(:application) { :helm }
+
+ subject { presenter.install_applications_cluster_path(cluster, application) }
+
+ it { is_expected.to eq(install_applications_project_cluster_path(project, cluster, application)) }
+ end
+
+ describe '#cluster_path' do
+ subject { presenter.cluster_path(cluster) }
+
+ it { is_expected.to eq(project_cluster_path(project, cluster)) }
+ end
+
describe '#clusterable_params' do
subject { presenter.clusterable_params }