summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2017-04-25 17:07:09 -0500
committerRobert Speicher <rspeicher@gmail.com>2017-05-01 11:12:13 -0400
commit0a556523cfee57e54e8e1227b818085c8d8c4ecc (patch)
treec8dd7fb1b880ff668a83aabd8ef93be2da7389a4
parent0789d7aab31674dc6158c8d4f8687fcff281e8a2 (diff)
downloadgitlab-ce-0a556523cfee57e54e8e1227b818085c8d8c4ecc.tar.gz
Enable `RSpec/DescribedClass` cop
-rw-r--r--.rubocop.yml2
-rw-r--r--doc/development/testing.md5
2 files changed, 4 insertions, 3 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index 8c43f6909cf..e53af97a92c 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -961,7 +961,7 @@ RSpec/DescribeSymbol:
# Checks that the second argument to top level describe is the tested method
# name.
RSpec/DescribedClass:
- Enabled: false
+ Enabled: true
# Checks for long example.
RSpec/ExampleLength:
diff --git a/doc/development/testing.md b/doc/development/testing.md
index 9b0b9808827..6d8b846d27f 100644
--- a/doc/development/testing.md
+++ b/doc/development/testing.md
@@ -188,7 +188,8 @@ Please consult the [dedicated "Frontend testing" guide](./fe_guide/testing.md).
### General Guidelines
- Use a single, top-level `describe ClassName` block.
-- Use `described_class` instead of repeating the class name being described.
+- Use `described_class` instead of repeating the class name being described
+ (_this is enforced by RuboCop_).
- Use `.method` to describe class methods and `#method` to describe instance
methods.
- Use `context` to test branching logic.
@@ -197,7 +198,7 @@ Please consult the [dedicated "Frontend testing" guide](./fe_guide/testing.md).
- 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_).
+- Prefer `not_to` to `to_not` (_this is enforced by RuboCop_).
- Try to match the ordering of tests to the ordering within the class.
- Try to follow the [Four-Phase Test][four-phase-test] pattern, using newlines
to separate phases.