diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-05-09 22:24:24 +0200 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-05-11 23:07:12 +0200 |
commit | 693602d957b2bb48a5270d249a2e2708c03bd803 (patch) | |
tree | f68006a9b15cf54fde168ae9997796994bb60ed5 /spec/models | |
parent | 4f824d2aecf4fec46febd767fa7f7d747c732112 (diff) | |
download | gitlab-ce-693602d957b2bb48a5270d249a2e2708c03bd803.tar.gz |
Keep presentation logic in one place and remove unecessary arguments.
+ fix tests
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/deployment_spec.rb | 9 | ||||
-rw-r--r-- | spec/models/environment_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/project_services/prometheus_service_spec.rb | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb index 212fcd884a8..4bda7d4314a 100644 --- a/spec/models/deployment_spec.rb +++ b/spec/models/deployment_spec.rb @@ -52,7 +52,7 @@ describe Deployment, models: true do describe '#metrics' do let(:deployment) { create(:deployment) } - subject { deployment.metrics(1.hour) } + subject { deployment.metrics } context 'metrics are disabled' do it { is_expected.to eq({}) } @@ -63,16 +63,17 @@ describe Deployment, models: true do { success: true, metrics: {}, - last_update: 42 + last_update: 42, + deployment_time: 1494408956 } end before do - allow(deployment.project).to receive_message_chain(:monitoring_service, :metrics) + allow(deployment.project).to receive_message_chain(:monitoring_service, :deployment_metrics) .with(any_args).and_return(simple_metrics) end - it { is_expected.to eq(simple_metrics.merge(deployment_time: deployment.created_at.utc.to_i)) } + it { is_expected.to eq(simple_metrics) } end end diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index edc1c204014..12519de8636 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -393,7 +393,7 @@ describe Environment, models: true do it 'returns the metrics from the deployment service' do expect(project.monitoring_service) - .to receive(:metrics).with(environment) + .to receive(:environment_metrics).with(environment) .and_return(:fake_metrics) is_expected.to eq(:fake_metrics) diff --git a/spec/models/project_services/prometheus_service_spec.rb b/spec/models/project_services/prometheus_service_spec.rb index 739850a836e..1f9d3c07b51 100644 --- a/spec/models/project_services/prometheus_service_spec.rb +++ b/spec/models/project_services/prometheus_service_spec.rb @@ -82,7 +82,7 @@ describe PrometheusService, models: true, caching: true do end it 'returns reactive data' do - is_expected.to eq(prometheus_data) + is_expected.to eq(prometheus_data.merge(deployment_time: deployment.created_at.to_i)) end end end |