diff options
Diffstat (limited to 'spec/helpers/clusters_helper_spec.rb')
-rw-r--r-- | spec/helpers/clusters_helper_spec.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/helpers/clusters_helper_spec.rb b/spec/helpers/clusters_helper_spec.rb index 5651b899ed0..eec62bbb990 100644 --- a/spec/helpers/clusters_helper_spec.rb +++ b/spec/helpers/clusters_helper_spec.rb @@ -58,4 +58,39 @@ describe ClustersHelper do it { is_expected.to eq('Create new cluster') } end end + + describe '#cluster_type_label' do + subject { helper.cluster_type_label(cluster_type) } + + context 'project cluster' do + let(:cluster_type) { 'project_type' } + + it { is_expected.to eq('Project cluster') } + end + + context 'group cluster' do + let(:cluster_type) { 'group_type' } + + it { is_expected.to eq('Group cluster') } + end + + context 'instance cluster' do + let(:cluster_type) { 'instance_type' } + + it { is_expected.to eq('Instance cluster') } + end + + context 'other values' do + let(:cluster_type) { 'not_supported' } + + it 'Diplays generic cluster and reports error' do + expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception).with( + an_instance_of(ArgumentError), + cluster_error: { error: 'Cluster Type Missing', cluster_type: 'not_supported' } + ) + + is_expected.to eq('Cluster') + end + end + end end |