diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/lib/banzai/filter/inline_metrics_redactor_filter_spec.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/lib/banzai/filter/inline_metrics_redactor_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/inline_metrics_redactor_filter_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/lib/banzai/filter/inline_metrics_redactor_filter_spec.rb b/spec/lib/banzai/filter/inline_metrics_redactor_filter_spec.rb index 9d8cd729958..cafcaef8ae2 100644 --- a/spec/lib/banzai/filter/inline_metrics_redactor_filter_spec.rb +++ b/spec/lib/banzai/filter/inline_metrics_redactor_filter_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Banzai::Filter::InlineMetricsRedactorFilter do +RSpec.describe Banzai::Filter::InlineMetricsRedactorFilter do include FilterSpecHelper let_it_be(:project) { create(:project) } @@ -29,6 +29,26 @@ describe Banzai::Filter::InlineMetricsRedactorFilter do it_behaves_like 'retains the embed placeholder when applicable' end + context 'for a cluster metric embed' do + let_it_be(:cluster) { create(:cluster, :provided_by_gcp, :project, projects: [project]) } + let(:params) { [project.namespace.path, project.path, cluster.id] } + let(:query_params) { { group: 'Cluster Health', title: 'CPU Usage', y_label: 'CPU (cores)' } } + let(:url) { urls.metrics_dashboard_namespace_project_cluster_url(*params, **query_params) } + + context 'with user who can read cluster' do + it_behaves_like 'redacts the embed placeholder' + it_behaves_like 'retains the embed placeholder when applicable' + end + + context 'without user who can read cluster' do + let(:doc) { filter(input, current_user: create(:user)) } + + it 'redacts the embed placeholder' do + expect(doc.to_s).to be_empty + end + end + end + context 'the user has requisite permissions' do let(:user) { create(:user) } let(:doc) { filter(input, current_user: user) } |