Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2016-10-17 15:40:02 +0300
committerNick Thomas <nick@gitlab.com>2016-10-17 16:44:20 +0300
commitbfb20200e9d1e7edd82a27d18d849ffba043845a (patch)
tree28f614cb61db165c8ebf1524d981e91755bec17f /spec/requests/api/notes_spec.rb
parent77507df6030dad9e317e092c70003d4c85d8f889 (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/requests/api/notes_spec.rb')
-rw-r--r--spec/requests/api/notes_spec.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb
index 063a8706e76..d58bedc3bf7 100644
--- a/spec/requests/api/notes_spec.rb
+++ b/spec/requests/api/notes_spec.rb
@@ -217,7 +217,7 @@ describe API::API, api: true do
expect(response).to have_http_status(201)
expect(json_response['body']).to eq('hi!')
expect(json_response['author']['username']).to eq(user.username)
- expect(Time.parse(json_response['created_at'])).to be_within(1.second).of(creation_time)
+ expect(Time.parse(json_response['created_at'])).to be_like_time(creation_time)
end
end