summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-11-22 15:05:37 +0100
committerJames Lopez <james@jameslopez.es>2016-11-22 15:05:37 +0100
commitdb62eb957157ffe14a474f5f858c753cade067b1 (patch)
tree3b3c3930fd49c3b338010e5bc23280d684d2426c /spec/serializers
parentb1b5060dbad15975184ec20a1914c7c48fc804db (diff)
downloadgitlab-ce-db62eb957157ffe14a474f5f858c753cade067b1.tar.gz
fixed bug to do with calculating durations
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/analytics_build_entity_spec.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/serializers/analytics_build_entity_spec.rb b/spec/serializers/analytics_build_entity_spec.rb
index 9ac6f20fd3c..a802c0fa49d 100644
--- a/spec/serializers/analytics_build_entity_spec.rb
+++ b/spec/serializers/analytics_build_entity_spec.rb
@@ -7,7 +7,7 @@ describe AnalyticsBuildEntity do
context 'build with an author' do
let(:user) { create(:user) }
- let(:build) { create(:ci_build, author: user) }
+ let(:build) { create(:ci_build, author: user, started_at: 2.hours.ago, finished_at: 1.hour.ago) }
subject { entity.as_json }
@@ -23,5 +23,13 @@ describe AnalyticsBuildEntity do
expect(subject).not_to include(/token/)
expect(subject).not_to include(/variables/)
end
+
+ it 'contains the right started at' do
+ expect(subject[:date]).to eq('about 2 hours ago')
+ end
+
+ it 'contains the duration' do
+ expect(subject[:total_time]).to eq({ :hours => 1 })
+ end
end
end