diff options
author | James Lopez <james@gitlab.com> | 2016-12-15 08:55:04 +0000 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2016-12-15 08:55:04 +0000 |
commit | 74e3927425881136ee532c6177af5538a9ece2c7 (patch) | |
tree | 370ffee7dcc0f2322ffa0feed3a5f133d4aaf54f | |
parent | 19435b9ac976c3bb771316a5195340fe3c022607 (diff) | |
parent | 5ac78a23693281ee693a383c9145b270d4602b09 (diff) | |
download | gitlab-ce-74e3927425881136ee532c6177af5538a9ece2c7.tar.gz |
Merge branch 'fix/transient-failing-analytics-spec' into 'master'
Fix transient failure on AnalyticsBuildEntity
AnalyticsBuildEntity uses `Time.now` to calculate durations, and on slow running builds could fail this spec. Mocking with `Timecop` should be sufficient to fix this.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/25500
See merge request !8082
-rw-r--r-- | spec/serializers/analytics_build_entity_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/serializers/analytics_build_entity_spec.rb b/spec/serializers/analytics_build_entity_spec.rb index 6b33fe66a63..86e703a6448 100644 --- a/spec/serializers/analytics_build_entity_spec.rb +++ b/spec/serializers/analytics_build_entity_spec.rb @@ -13,6 +13,14 @@ describe AnalyticsBuildEntity do subject { entity.as_json } + before do + Timecop.freeze + end + + after do + Timecop.return + end + it 'contains the URL' do expect(subject).to include(:url) end |