diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-03-05 21:02:26 +0100 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-03-05 21:02:26 +0100 |
commit | b53356546dc54a6674eda8fa2d4f730a70f77206 (patch) | |
tree | 35e655f82b3f80039cded957b866ba16629eb2b5 /spec/controllers | |
parent | 5ceec83a0154e513480a9bb08e252371bf7886c6 (diff) | |
download | gitlab-ce-b53356546dc54a6674eda8fa2d4f730a70f77206.tar.gz |
Check if prometheus_adapter is properly called
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/prometheus/metrics_controller_spec.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/controllers/projects/prometheus/metrics_controller_spec.rb b/spec/controllers/projects/prometheus/metrics_controller_spec.rb index 9d2ac42e99f..b2b245dba90 100644 --- a/spec/controllers/projects/prometheus/metrics_controller_spec.rb +++ b/spec/controllers/projects/prometheus/metrics_controller_spec.rb @@ -7,13 +7,15 @@ describe Projects::Prometheus::MetricsController do let(:prometheus_adapter) { double('prometheus_adapter', can_query?: true) } before do - allow(controller).to receive(:prometheus_adapter).and_return(prometheus_adapter) - project.add_master(user) sign_in(user) end describe 'GET #active_common' do + before do + allow(controller).to receive(:prometheus_adapter).and_return(prometheus_adapter) + end + context 'when prometheus metrics are enabled' do context 'when data is not present' do before do @@ -52,6 +54,18 @@ describe Projects::Prometheus::MetricsController do end end + describe '#prometheus_adapter' do + before do + allow(controller).to receive(:project).and_return(project) + end + + it 'calls prometheus adapter service' do + expect_any_instance_of(::Prometheus::AdapterService).to receive(:prometheus_adapter) + + subject.__send__(:prometheus_adapter) + end + end + def project_params(opts = {}) opts.reverse_merge(namespace_id: project.namespace, project_id: project) end |