Commit 13f37264 authored by Małgorzata Ksionek's avatar Małgorzata Ksionek

Rephrase specs description for cycle analytics

parent ee92accc
...@@ -11,6 +11,6 @@ class AnalyticsStageEntity < Grape::Entity ...@@ -11,6 +11,6 @@ class AnalyticsStageEntity < Grape::Entity
expose :median, as: :value do |stage| expose :median, as: :value do |stage|
# median returns a BatchLoader instance which we first have to unwrap by using to_f # median returns a BatchLoader instance which we first have to unwrap by using to_f
# we use to_f to make sure results below 1 are presented to the end-user # we use to_f to make sure results below 1 are presented to the end-user
!stage.median.to_f.zero? ? distance_of_time_in_words(stage.median) : nil stage.median.to_f.nonzero? ? distance_of_time_in_words(stage.median) : nil
end end
end end
--- ---
title: Display improvements for cycle analytics - stop casting to integers title: Show data on Cycle Analytics page when value is less than a second
merge_request: 28507 merge_request: 28507
author: author:
type: fixed type: fixed
...@@ -27,7 +27,7 @@ describe AnalyticsStageSerializer do ...@@ -27,7 +27,7 @@ describe AnalyticsStageSerializer do
allow_any_instance_of(Gitlab::CycleAnalytics::BaseStage).to receive(:median).and_return(0) allow_any_instance_of(Gitlab::CycleAnalytics::BaseStage).to receive(:median).and_return(0)
end end
it 'value is nil' do it 'sets the value to nil' do
expect(subject.fetch(:value)).to be_nil expect(subject.fetch(:value)).to be_nil
end end
end end
...@@ -37,18 +37,18 @@ describe AnalyticsStageSerializer do ...@@ -37,18 +37,18 @@ describe AnalyticsStageSerializer do
allow_any_instance_of(Gitlab::CycleAnalytics::BaseStage).to receive(:median).and_return(0.12) allow_any_instance_of(Gitlab::CycleAnalytics::BaseStage).to receive(:median).and_return(0.12)
end end
it 'value is equal to median' do it 'sets the value to equal to median' do
expect(subject.fetch(:value)).to eq('less than a minute') expect(subject.fetch(:value)).to eq('less than a minute')
end end
end end
context 'when median is above 1' do context 'when median is above 1' do
before do before do
allow_any_instance_of(Gitlab::CycleAnalytics::BaseStage).to receive(:median).and_return(1.12) allow_any_instance_of(Gitlab::CycleAnalytics::BaseStage).to receive(:median).and_return(60.12)
end end
it 'value is equal to median' do it 'sets the value to equal to median' do
expect(subject.fetch(:value)).to eq('less than a minute') expect(subject.fetch(:value)).to eq('1 minute')
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment