diff options
author | Małgorzata Ksionek <meksionek@gmail.com> | 2019-05-27 12:44:02 +0200 |
---|---|---|
committer | Małgorzata Ksionek <meksionek@gmail.com> | 2019-05-27 12:44:02 +0200 |
commit | 13f37264349d1c9a016335ba37c6f5bd2d5910df (patch) | |
tree | 325e4c092eae2f50430ac79aa1f446a8d01d7dc3 | |
parent | ee92acccb47c073992f46f9b8f9132a8ef9a92a6 (diff) | |
download | gitlab-ce-13f37264349d1c9a016335ba37c6f5bd2d5910df.tar.gz |
Rephrase specs description for cycle analytics30138-display-cycle-analytics-issue
-rw-r--r-- | app/serializers/analytics_stage_entity.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/30138-display-cycle-analytics-issue.yml | 2 | ||||
-rw-r--r-- | spec/serializers/analytics_stage_serializer_spec.rb | 10 |
3 files changed, 7 insertions, 7 deletions
diff --git a/app/serializers/analytics_stage_entity.rb b/app/serializers/analytics_stage_entity.rb index 64eba185a4e..8bc6da5aeeb 100644 --- a/app/serializers/analytics_stage_entity.rb +++ b/app/serializers/analytics_stage_entity.rb @@ -11,6 +11,6 @@ class AnalyticsStageEntity < Grape::Entity expose :median, as: :value do |stage| # 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 - !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 diff --git a/changelogs/unreleased/30138-display-cycle-analytics-issue.yml b/changelogs/unreleased/30138-display-cycle-analytics-issue.yml index 21477285323..c7faa0480bd 100644 --- a/changelogs/unreleased/30138-display-cycle-analytics-issue.yml +++ b/changelogs/unreleased/30138-display-cycle-analytics-issue.yml @@ -1,5 +1,5 @@ --- -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 author: type: fixed diff --git a/spec/serializers/analytics_stage_serializer_spec.rb b/spec/serializers/analytics_stage_serializer_spec.rb index 907d1b35e74..5b05c2f2ef3 100644 --- a/spec/serializers/analytics_stage_serializer_spec.rb +++ b/spec/serializers/analytics_stage_serializer_spec.rb @@ -27,7 +27,7 @@ describe AnalyticsStageSerializer do allow_any_instance_of(Gitlab::CycleAnalytics::BaseStage).to receive(:median).and_return(0) end - it 'value is nil' do + it 'sets the value to nil' do expect(subject.fetch(:value)).to be_nil end end @@ -37,18 +37,18 @@ describe AnalyticsStageSerializer do allow_any_instance_of(Gitlab::CycleAnalytics::BaseStage).to receive(:median).and_return(0.12) 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') end end context 'when median is above 1' 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 - it 'value is equal to median' do - expect(subject.fetch(:value)).to eq('less than a minute') + it 'sets the value to equal to median' do + expect(subject.fetch(:value)).to eq('1 minute') end end end |