2019-10-25 05:06:06 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-05-24 06:25:44 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe ConversationalDevelopmentIndex::MetricPresenter do
|
|
|
|
subject { described_class.new(metric) }
|
2019-10-18 07:11:44 -04:00
|
|
|
|
2019-11-29 01:06:31 -05:00
|
|
|
let(:metric) { build(:dev_ops_score_metric) }
|
2017-05-24 06:25:44 -04:00
|
|
|
|
|
|
|
describe '#cards' do
|
|
|
|
it 'includes instance score, leader score and percentage score' do
|
|
|
|
issues_card = subject.cards.first
|
|
|
|
|
2017-08-01 02:46:43 -04:00
|
|
|
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)
|
2017-05-24 06:25:44 -04:00
|
|
|
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
|