diff options
author | James Lopez <james@jameslopez.es> | 2016-11-24 14:38:54 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-11-25 13:47:33 +0300 |
commit | 9c49fa2d92a3ab1051df87e4d75d9802a1b7cfc7 (patch) | |
tree | 7081443e9d0cb6af6cf5707ecdb13ade48c692f0 /spec/serializers/analytics_build_entity_spec.rb | |
parent | afe90d529c82566886d1f2513dd6bee4fa73ff94 (diff) |
fix for builds with no start date and spec
Diffstat (limited to 'spec/serializers/analytics_build_entity_spec.rb')
-rw-r--r-- | spec/serializers/analytics_build_entity_spec.rb | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/spec/serializers/analytics_build_entity_spec.rb b/spec/serializers/analytics_build_entity_spec.rb index c0b7e86b17c..ba562353661 100644 --- a/spec/serializers/analytics_build_entity_spec.rb +++ b/spec/serializers/analytics_build_entity_spec.rb @@ -7,7 +7,9 @@ describe AnalyticsBuildEntity do context 'build with an author' do let(:user) { create(:user) } - let(:build) { create(:ci_build, author: user, started_at: 2.hours.ago, finished_at: 1.hour.ago) } + let(:started_at) { 2.hours.ago } + let(:finished_at) { 1.hour.ago } + let(:build) { create(:ci_build, author: user, started_at: started_at, finished_at: finished_at) } subject { entity.as_json } @@ -31,5 +33,32 @@ describe AnalyticsBuildEntity do it 'contains the duration' do expect(subject[:total_time]).to eq(hours: 1 ) end + + context 'no started at or finished at date' do + let(:started_at) { nil } + let(:finished_at) { nil } + + it 'does not blow up' do + expect{ subject[:date] }.not_to raise_error + end + + it '' + end + + context 'no started at date' do + let(:started_at) { nil } + + it 'does not blow up' do + expect{ subject[:date] }.not_to raise_error + end + end + + context 'no finished at date' do + let(:finished_at) { nil } + + it 'does not blow up' do + expect{ subject[:date] }.not_to raise_error + end + end end end |