Skip to content

Commit b92709e

Browse files
committed
Remove developer documentation about not describing symbols
This is now covered by rubocop-rspec.
1 parent 651bf36 commit b92709e

File tree

2 files changed

+0
-30
lines changed

2 files changed

+0
-30
lines changed

doc/development/gotchas.md

-29
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,6 @@
33
The purpose of this guide is to document potential "gotchas" that contributors
44
might encounter or should avoid during development of GitLab CE and EE.
55

6-
## Do not `describe` symbols
7-
8-
Consider the following model spec:
9-
10-
```ruby
11-
require 'rails_helper'
12-
13-
describe User do
14-
describe :to_param do
15-
it 'converts the username to a param' do
16-
user = described_class.new(username: 'John Smith')
17-
18-
expect(user.to_param).to eq 'john-smith'
19-
end
20-
end
21-
end
22-
```
23-
24-
When run, this spec doesn't do what we might expect:
25-
26-
```sh
27-
spec/models/user_spec.rb|6 error| Failure/Error: u = described_class.new NoMethodError: undefined method `new' for :to_param:Symbol
28-
```
29-
30-
### Solution
31-
32-
Except for the top-level `describe` block, always provide a String argument to
33-
`describe`.
34-
356
## Do not assert against the absolute value of a sequence-generated attribute
367

378
Consider the following factory:

doc/development/testing.md

-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ Please consult the [dedicated "Frontend testing" guide](./fe_guide/testing.md).
195195
- Use `context` to test branching logic.
196196
- Use multi-line `do...end` blocks for `before` and `after`, even when it would
197197
fit on a single line.
198-
- Don't `describe` symbols (see [Gotchas](gotchas.md#dont-describe-symbols)).
199198
- 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)).
200199
- Don't supply the `:each` argument to hooks since it's the default.
201200
- Prefer `not_to` to `to_not` (_this is enforced by RuboCop_).

0 commit comments

Comments
 (0)