Commit 80cf553a authored by anna_vovchenko's avatar anna_vovchenko Committed by charlie ablett

Implemented suggestion changes after the BE review

parent 02e3bcc7
......@@ -5,14 +5,6 @@ module ClustersHelper
clusterable.is_a?(Project)
end
def default_branch_name(clusterable)
return clusterable.default_branch if clusterable.is_a?(Project)
end
def clusterable_project_path(clusterable)
return clusterable.full_path if clusterable.is_a?(Project)
end
def js_clusters_list_data(clusterable)
{
ancestor_help_path: help_page_path('user/group/clusters/index', anchor: 'cluster-precedence'),
......@@ -116,4 +108,14 @@ module ClustersHelper
def can_admin_cluster?(user, cluster)
can?(user, :admin_cluster, cluster)
end
private
def default_branch_name(clusterable)
return clusterable.default_branch if clusterable.is_a?(Project)
end
def clusterable_project_path(clusterable)
return clusterable.full_path if clusterable.is_a?(Project)
end
end
......@@ -38,6 +38,11 @@ RSpec.describe ClustersHelper do
subject { helper.js_clusters_list_data(clusterable) }
before do
helper.send(:default_branch_name, clusterable)
helper.send(:clusterable_project_path, clusterable)
end
it 'displays endpoint path' do
expect(subject[:endpoint]).to eq("#{project_path(project)}/-/clusters.json")
end
......@@ -124,6 +129,14 @@ RSpec.describe ClustersHelper do
it 'displays display_cluster_agents as false' do
expect(subject[:display_cluster_agents]).to eq("false")
end
it 'does not include a default branch' do
expect(subject[:default_branch_name]).to be_nil
end
it 'does not include a project path' do
expect(subject[:project_path]).to be_nil
end
end
describe 'certificate based clusters enabled' do
......
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