summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-05-22 23:35:18 -0700
committerStan Hu <stanhu@gmail.com>2016-05-22 23:52:50 -0700
commit9bb0d0b4079bc88134399f175ce9631005044060 (patch)
tree9c1af50c90db6756ecbd9b4a2ee7d57edf5f49e5 /spec
parent53ad33e4ba1b079e4f2aebceb42a7301c5ce2e4a (diff)
downloadgitlab-ce-9bb0d0b4079bc88134399f175ce9631005044060.tar.gz
Fix Error 500 in CI charts by gracefully handling commits with no durations
Closes #17730
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/ci/charts_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/lib/ci/charts_spec.rb b/spec/lib/ci/charts_spec.rb
index 50a77308cde..9d1215a5760 100644
--- a/spec/lib/ci/charts_spec.rb
+++ b/spec/lib/ci/charts_spec.rb
@@ -12,5 +12,12 @@ describe Ci::Charts, lib: true do
chart = Ci::Charts::BuildTime.new(@commit.project)
expect(chart.build_times).to eq([2])
end
+
+ it 'should handle nil build times' do
+ create(:ci_commit, duration: nil, project: @commit.project)
+
+ chart = Ci::Charts::BuildTime.new(@commit.project)
+ expect(chart.build_times).to eq([2, 0])
+ end
end
end