require'spec_helper'describeConversationalDevelopmentIndex::MetricPresenterdosubject{described_class.new(metric)}let(:metric){build(:conversational_development_index_metric)}describe'#cards'doit'includes instance score, leader score and percentage score'doissues_card=subject.cards.firstexpect(issues_card.instance_score).toeq1.234expect(issues_card.leader_score).toeq9.256expect(issues_card.percentage_score).tobe_within(0.1).of(13.3)endenddescribe'#idea_to_production_steps'doit'returns percentage score when it depends on a single feature'docode_step=subject.idea_to_production_steps.fourthexpect(code_step.percentage_score).tobe_within(0.1).of(50.0)endit'returns percentage score when it depends on two features'doissue_step=subject.idea_to_production_steps.secondexpect(issue_step.percentage_score).tobe_within(0.1).of(53.0)endenddescribe'#average_percentage_score'doit'calculates an average value across all the features'doexpect(subject.average_percentage_score).tobe_within(0.1).of(55.8)endendend