From 85dc423f7090da0a52c73eb66faf22ddb20efff9 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Sat, 19 Sep 2020 01:45:44 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-4-stable-ee --- .../dev_ops_report/metric_presenter_spec.rb | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 spec/presenters/dev_ops_report/metric_presenter_spec.rb (limited to 'spec/presenters/dev_ops_report/metric_presenter_spec.rb') diff --git a/spec/presenters/dev_ops_report/metric_presenter_spec.rb b/spec/presenters/dev_ops_report/metric_presenter_spec.rb new file mode 100644 index 00000000000..306b5592c33 --- /dev/null +++ b/spec/presenters/dev_ops_report/metric_presenter_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe DevOpsReport::MetricPresenter do + subject { described_class.new(metric) } + + let(:metric) { build(:dev_ops_report_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 -- cgit v1.2.1