diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-22 21:19:55 +0200 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-22 21:19:55 +0200 |
commit | e00f487049e811c497ba3780f38f7e1a8572ad97 (patch) | |
tree | 808d99bb2d43f9620fc2074ea9068ec4f8bf0b0d /spec/models | |
parent | 97c42df3b804a37e659c3cda6bd8a52570f31366 (diff) | |
download | gitlab-ce-e00f487049e811c497ba3780f38f7e1a8572ad97.tar.gz |
Fix bug where Service `created_at` time was used instead of deployment time.33933-fix-deployment-indicator-date
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/project_services/prometheus_service_spec.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/spec/models/project_services/prometheus_service_spec.rb b/spec/models/project_services/prometheus_service_spec.rb index c914b32f7a4..37f23b1243c 100644 --- a/spec/models/project_services/prometheus_service_spec.rb +++ b/spec/models/project_services/prometheus_service_spec.rb @@ -71,7 +71,7 @@ describe PrometheusService, models: true, caching: true do end describe '#deployment_metrics' do - let(:deployment) { build_stubbed(:deployment)} + let(:deployment) { build_stubbed(:deployment) } let(:deployment_query) { Gitlab::Prometheus::Queries::DeploymentQuery } around do |example| @@ -80,13 +80,16 @@ describe PrometheusService, models: true, caching: true do context 'with valid data' do subject { service.deployment_metrics(deployment) } + let(:fake_deployment_time) { 10 } before do stub_reactive_cache(service, prometheus_data, deployment_query, deployment.id) end it 'returns reactive data' do - is_expected.to eq(prometheus_metrics_data.merge(deployment_time: deployment.created_at.to_i)) + expect(deployment).to receive(:created_at).and_return(fake_deployment_time) + + expect(subject).to eq(prometheus_metrics_data.merge(deployment_time: fake_deployment_time)) end end end |