diff options
Diffstat (limited to 'spec/controllers/projects/prometheus/metrics_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/prometheus/metrics_controller_spec.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/controllers/projects/prometheus/metrics_controller_spec.rb b/spec/controllers/projects/prometheus/metrics_controller_spec.rb index 5338b77bd08..7dfa283195e 100644 --- a/spec/controllers/projects/prometheus/metrics_controller_spec.rb +++ b/spec/controllers/projects/prometheus/metrics_controller_spec.rb @@ -141,7 +141,7 @@ RSpec.describe Projects::Prometheus::MetricsController do expect(flash[:notice]).to include('Metric was successfully added.') - expect(response).to redirect_to(edit_project_service_path(project, ::Integrations::Prometheus)) + expect(response).to redirect_to(edit_project_integration_path(project, ::Integrations::Prometheus)) end end @@ -157,6 +157,22 @@ RSpec.describe Projects::Prometheus::MetricsController do end end + describe 'PUT #update' do + context 'metric is updated' do + let_it_be(:metric) { create(:prometheus_metric, project: project) } + + let(:metric_params) { { prometheus_metric: { title: 'new_title' }, id: metric.id } } + + it 'shows a success flash message' do + put :update, params: project_params(metric_params) + + expect(metric.reload.title).to eq('new_title') + expect(flash[:notice]).to include('Metric was successfully updated.') + expect(response).to redirect_to(edit_project_integration_path(project, ::Integrations::Prometheus)) + end + end + end + describe 'DELETE #destroy' do context 'format html' do let!(:metric) { create(:prometheus_metric, project: project) } @@ -164,7 +180,7 @@ RSpec.describe Projects::Prometheus::MetricsController do it 'destroys the metric' do delete :destroy, params: project_params(id: metric.id) - expect(response).to redirect_to(edit_project_service_path(project, ::Integrations::Prometheus)) + expect(response).to redirect_to(edit_project_integration_path(project, ::Integrations::Prometheus)) expect(PrometheusMetric.find_by(id: metric.id)).to be_nil end end |