Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-06-22 22:19:55 +0300
committerPawel Chojnacki <pawel@chojnacki.ws>2017-06-22 22:19:55 +0300
commite00f487049e811c497ba3780f38f7e1a8572ad97 (patch)
tree808d99bb2d43f9620fc2074ea9068ec4f8bf0b0d /spec/models/project_services
parent97c42df3b804a37e659c3cda6bd8a52570f31366 (diff)
Fix bug where Service `created_at` time was used instead of deployment time.
Diffstat (limited to 'spec/models/project_services')
-rw-r--r--spec/models/project_services/prometheus_service_spec.rb7
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