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:
authorRobert Speicher <rspeicher@gmail.com>2017-02-20 18:39:51 +0300
committerRobert Speicher <rspeicher@gmail.com>2017-02-20 18:39:51 +0300
commitec3262549b2e0c86988b3593464c71f176a66128 (patch)
tree76771d8f9b0c6dfcfbe5cf7d0764df8b76fd5096
parentfbbbf1e4e77768a40b835455f17749384f7c4984 (diff)
Document Timecop usage for time-sensitive tests
-rw-r--r--doc/development/testing.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/development/testing.md b/doc/development/testing.md
index 761847b2bab..b3c19e396d0 100644
--- a/doc/development/testing.md
+++ b/doc/development/testing.md
@@ -95,6 +95,25 @@ so we need to set some guidelines for their use going forward:
[lets-not]: https://robots.thoughtbot.com/lets-not
+### Time-sensitive tests
+
+[Timecop](https://github.com/travisjeffery/timecop) is available in our
+Ruby-based tests for verifying things that are time-sensitive. Any test that
+exercises or verifies something time-sensitive should make use of Timecop to
+prevent transient test failures.
+
+Example:
+
+```ruby
+it 'is overdue' do
+ issue = build(:issue, due_date: Date.tomorrow)
+
+ Timecop.freeze(3.days.from_now) do
+ expect(issue).to be_overdue
+ end
+end
+```
+
### Test speed
GitLab has a massive test suite that, without parallelization, can take more