diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 12:09:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 12:09:09 +0300 |
commit | c384315ae1ea48df2a741874b326581ded0a97e1 (patch) | |
tree | 6f50dfdb7fb726ef3e738dc5264526cf683906a3 /spec/presenters/dev_ops_score | |
parent | e1e017ddc4d64e4777bbe663c555093a7ae0cca3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/presenters/dev_ops_score')
-rw-r--r-- | spec/presenters/dev_ops_score/metric_presenter_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/presenters/dev_ops_score/metric_presenter_spec.rb b/spec/presenters/dev_ops_score/metric_presenter_spec.rb new file mode 100644 index 00000000000..b6eab3f2e74 --- /dev/null +++ b/spec/presenters/dev_ops_score/metric_presenter_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe DevOpsScore::MetricPresenter do + subject { described_class.new(metric) } + + let(:metric) { build(:dev_ops_score_metric) } + + describe '#cards' do + it 'includes instance score, leader score and percentage score' do + issues_card = subject.cards.first + + expect(issues_card.instance_score).to eq(1.234) + expect(issues_card.leader_score).to eq(9.256) + expect(issues_card.percentage_score).to eq(13.331) + end + end + + describe '#idea_to_production_steps' do + it 'returns percentage score when it depends on a single feature' do + code_step = subject.idea_to_production_steps.fourth + + expect(code_step.percentage_score).to be_within(0.1).of(50.0) + end + + it 'returns percentage score when it depends on two features' do + issue_step = subject.idea_to_production_steps.second + + expect(issue_step.percentage_score).to be_within(0.1).of(53.0) + end + end + + describe '#average_percentage_score' do + it 'calculates an average value across all the features' do + expect(subject.average_percentage_score).to be_within(0.1).of(55.8) + end + end +end |