diff options
author | Rémy Coutable <remy@rymai.me> | 2017-07-19 08:54:22 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-07-19 08:54:22 +0000 |
commit | fa8ec52a717a1e019e867ebd884c20f5f17bbe02 (patch) | |
tree | 78c505d34eb36afc5651bac01b6c3970d6f86671 | |
parent | 6c8ea9fbb6b6fdda1552bf011bf99a63237a6d60 (diff) | |
parent | b92709eaf4b513d4cf86c6cef0598b9cd1f45f13 (diff) | |
download | gitlab-ce-fa8ec52a717a1e019e867ebd884c20f5f17bbe02.tar.gz |
Merge branch 'rs-remove-describe-symbol-docs' into 'master'
Remove developer documentation about not describing symbols
See merge request !12953
-rw-r--r-- | doc/development/gotchas.md | 29 | ||||
-rw-r--r-- | doc/development/testing.md | 1 |
2 files changed, 0 insertions, 30 deletions
diff --git a/doc/development/gotchas.md b/doc/development/gotchas.md index 565d4b33457..c2ca8966a3f 100644 --- a/doc/development/gotchas.md +++ b/doc/development/gotchas.md @@ -3,35 +3,6 @@ The purpose of this guide is to document potential "gotchas" that contributors might encounter or should avoid during development of GitLab CE and EE. -## Do not `describe` symbols - -Consider the following model spec: - -```ruby -require 'rails_helper' - -describe User do - describe :to_param do - it 'converts the username to a param' do - user = described_class.new(username: 'John Smith') - - expect(user.to_param).to eq 'john-smith' - end - end -end -``` - -When run, this spec doesn't do what we might expect: - -```sh -spec/models/user_spec.rb|6 error| Failure/Error: u = described_class.new NoMethodError: undefined method `new' for :to_param:Symbol -``` - -### Solution - -Except for the top-level `describe` block, always provide a String argument to -`describe`. - ## Do not assert against the absolute value of a sequence-generated attribute Consider the following factory: diff --git a/doc/development/testing.md b/doc/development/testing.md index fc84932354b..e6aa4ae8f2f 100644 --- a/doc/development/testing.md +++ b/doc/development/testing.md @@ -195,7 +195,6 @@ Please consult the [dedicated "Frontend testing" guide](./fe_guide/testing.md). - Use `context` to test branching logic. - Use multi-line `do...end` blocks for `before` and `after`, even when it would fit on a single line. -- Don't `describe` symbols (see [Gotchas](gotchas.md#dont-describe-symbols)). - Don't assert against the absolute value of a sequence-generated attribute (see [Gotchas](gotchas.md#dont-assert-against-the-absolute-value-of-a-sequence-generated-attribute)). - Don't supply the `:each` argument to hooks since it's the default. - Prefer `not_to` to `to_not` (_this is enforced by RuboCop_). |