From 4c62a801b9786082c7eb67aa7de8db3ee35e155a Mon Sep 17 00:00:00 2001 From: Aditya Tiwari <atiwari@gitlab.com> Date: Tue, 23 Jul 2024 21:52:39 +0000 Subject: [PATCH] Add guideline to use example urls Add guideling to use example urls in rspec. --- doc/development/testing_guide/best_practices.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index 403edf187c93d..be19b1f674f44 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -59,6 +59,7 @@ When using spring and guard together, use `SPRING=1 bundle exec guard` instead t - Try to follow the [Four-Phase Test](https://thoughtbot.com/blog/four-phase-test) pattern, using newlines to separate phases. - Use `Gitlab.config.gitlab.host` rather than hard coding `'localhost'`. +- For literal URLs in tests, use `example.com`, `gitlab.example.com`. This will ensure that we do not utilize any real URLs. - Don't assert against the absolute value of a sequence-generated attribute (see [Gotchas](../gotchas.md#do-not-assert-against-the-absolute-value-of-a-sequence-generated-attribute)). - Avoid using `expect_any_instance_of` or `allow_any_instance_of` (see -- GitLab