diff options
Diffstat (limited to 'spec/views/projects/settings/operations/show.html.haml_spec.rb')
-rw-r--r-- | spec/views/projects/settings/operations/show.html.haml_spec.rb | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/spec/views/projects/settings/operations/show.html.haml_spec.rb b/spec/views/projects/settings/operations/show.html.haml_spec.rb index facb4e2016d..a22853d40d8 100644 --- a/spec/views/projects/settings/operations/show.html.haml_spec.rb +++ b/spec/views/projects/settings/operations/show.html.haml_spec.rb @@ -15,14 +15,6 @@ RSpec.describe 'projects/settings/operations/show' do end let_it_be(:prometheus_service) { create(:prometheus_service, project: project) } - let_it_be(:alerts_service) { create(:alerts_service, project: project) } - - let(:operations_show_locals) do - { - prometheus_service: prometheus_service, - alerts_service: alerts_service - } - end before_all do project.add_maintainer(user) @@ -35,13 +27,24 @@ RSpec.describe 'projects/settings/operations/show' do .and_return(error_tracking_setting) allow(view).to receive(:tracing_setting) .and_return(tracing_setting) + allow(view).to receive(:prometheus_service) + .and_return(prometheus_service) allow(view).to receive(:current_user).and_return(user) end + describe 'Operations > Alerts' do + it 'renders the Operations Settings page' do + render + + expect(rendered).to have_content _('Alerts') + expect(rendered).to have_content _('Display alerts from all your monitoring tools directly within GitLab.') + end + end + describe 'Operations > Error Tracking' do context 'Settings page ' do it 'renders the Operations Settings page' do - render template: 'projects/settings/operations/show', locals: operations_show_locals + render expect(rendered).to have_content _('Error tracking') expect(rendered).to have_content _('To link Sentry to GitLab, enter your Sentry URL and Auth Token') @@ -49,10 +52,34 @@ RSpec.describe 'projects/settings/operations/show' do end end + describe 'Operations > Prometheus' do + context 'when settings_operations_prometheus_service flag is enabled' do + it 'renders the Operations Settings page' do + render + + expect(rendered).to have_content _('Prometheus') + expect(rendered).to have_content _('Link Prometheus monitoring to GitLab.') + expect(rendered).to have_content _('To enable the installation of Prometheus on your clusters, deactivate the manual configuration below') + end + end + + context 'when settings_operations_prometheus_service is disabled' do + before do + stub_feature_flags(settings_operations_prometheus_service: false) + end + + it 'renders the Operations Settings page' do + render + + expect(rendered).not_to have_content _('Select the Active checkbox to override the Auto Configuration with custom settings. If unchecked, Auto Configuration settings are used.') + end + end + end + describe 'Operations > Tracing' do context 'with project.tracing_external_url' do it 'links to project.tracing_external_url' do - render template: 'projects/settings/operations/show', locals: operations_show_locals + render expect(rendered).to have_link('Tracing', href: tracing_setting.external_url) end @@ -66,7 +93,7 @@ RSpec.describe 'projects/settings/operations/show' do end it 'sanitizes external_url' do - render template: 'projects/settings/operations/show', locals: operations_show_locals + render expect(tracing_setting.external_url).to eq(malicious_tracing_url) expect(rendered).to have_link('Tracing', href: cleaned_url) @@ -82,7 +109,7 @@ RSpec.describe 'projects/settings/operations/show' do end it 'links to Tracing page' do - render template: 'projects/settings/operations/show', locals: operations_show_locals + render expect(rendered).to have_link('Tracing', href: project_tracing_path(project)) end |