diff options
author | Nick Thomas <nick@gitlab.com> | 2016-10-17 15:40:02 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-10-17 16:44:20 +0300 |
commit | bfb20200e9d1e7edd82a27d18d849ffba043845a (patch) | |
tree | 28f614cb61db165c8ebf1524d981e91755bec17f /spec/services/git_push_service_spec.rb | |
parent | 77507df6030dad9e317e092c70003d4c85d8f889 (diff) |
Add a be_like_time matcher and use it in specs
The amount of precision times have in databases is variable, so we need
tolerances when comparing in specs. It's better to have the tolerance defined
in one place than several.
Diffstat (limited to 'spec/services/git_push_service_spec.rb')
-rw-r--r-- | spec/services/git_push_service_spec.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb index dd2a9e9903a..8dda34c7a03 100644 --- a/spec/services/git_push_service_spec.rb +++ b/spec/services/git_push_service_spec.rb @@ -364,7 +364,7 @@ describe GitPushService, services: true do it 'sets the metric for referenced issues' do execute_service(project, user, @oldrev, @newrev, @ref) - expect(issue.reload.metrics.first_mentioned_in_commit_at).to be_within(1.second).of(commit_time) + expect(issue.reload.metrics.first_mentioned_in_commit_at).to be_like_time(commit_time) end it 'does not set the metric for non-referenced issues' do |