Skip to content

Commit 54ee974

Browse files
authored
Merge pull request #1279 from koic/clarify_the_default_enforced_styles
[Doc] Clarify default enforced styles
2 parents 138cf60 + 603d0a6 commit 54ee974

13 files changed

+57
-27
lines changed

docs/modules/ROOT/pages/cops_rspec.adoc

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ directory.
699699

700700
=== Examples
701701

702-
==== `EnforcedStyle: described_class`
702+
==== `EnforcedStyle: described_class` (default)
703703

704704
[source,ruby]
705705
----
@@ -1300,7 +1300,7 @@ This cop can be configured using the `EnforcedStyle` option
13001300

13011301
=== Examples
13021302

1303-
==== `EnforcedStyle: always_allow`
1303+
==== `EnforcedStyle: always_allow` (default)
13041304

13051305
[source,ruby]
13061306
----
@@ -1539,7 +1539,7 @@ expect { run }.to change(Foo, :bar)
15391539
expect { run }.to change { Foo.bar }
15401540
----
15411541

1542-
==== `EnforcedStyle: method_call`
1542+
==== `EnforcedStyle: method_call` (default)
15431543

15441544
[source,ruby]
15451545
----
@@ -1800,7 +1800,7 @@ the same behavior.
18001800

18011801
=== Examples
18021802

1803-
==== when configuration is `EnforcedStyle: implicit`
1803+
==== `EnforcedStyle: implicit` (default)
18041804

18051805
[source,ruby]
18061806
----
@@ -1820,7 +1820,7 @@ before do
18201820
end
18211821
----
18221822

1823-
==== when configuration is `EnforcedStyle: each`
1823+
==== `EnforcedStyle: each`
18241824

18251825
[source,ruby]
18261826
----
@@ -1840,7 +1840,7 @@ before(:each) do
18401840
end
18411841
----
18421842

1843-
==== when configuration is `EnforcedStyle: example`
1843+
==== `EnforcedStyle: example`
18441844

18451845
[source,ruby]
18461846
----
@@ -2000,7 +2000,7 @@ and supports the `--auto-gen-config` flag.
20002000

20012001
=== Examples
20022002

2003-
==== `EnforcedStyle: is_expected`
2003+
==== `EnforcedStyle: is_expected` (default)
20042004

20052005
[source,ruby]
20062006
----
@@ -2244,7 +2244,7 @@ Checks that only one `it_behaves_like` style is used.
22442244

22452245
=== Examples
22462246

2247-
==== when configuration is `EnforcedStyle: it_behaves_like`
2247+
==== `EnforcedStyle: it_behaves_like` (default)
22482248

22492249
[source,ruby]
22502250
----
@@ -2255,7 +2255,7 @@ it_should_behave_like 'a foo'
22552255
it_behaves_like 'a foo'
22562256
----
22572257

2258-
==== when configuration is `EnforcedStyle: it_should_behave_like`
2258+
==== `EnforcedStyle: it_should_behave_like`
22592259

22602260
[source,ruby]
22612261
----
@@ -2617,7 +2617,7 @@ This cop can be configured in your configuration using the
26172617

26182618
=== Examples
26192619

2620-
==== `EnforcedStyle: allow`
2620+
==== `EnforcedStyle: allow` (default)
26212621

26222622
[source,ruby]
26232623
----
@@ -2672,7 +2672,7 @@ This cop can be configured in your configuration using the
26722672

26732673
=== Examples
26742674

2675-
==== `EnforcedStyle: have_received`
2675+
==== `EnforcedStyle: have_received` (default)
26762676

26772677
[source,ruby]
26782678
----
@@ -3230,6 +3230,8 @@ Checks for consistent method usage for negating expectations.
32303230

32313231
=== Examples
32323232

3233+
==== `EnforcedStyle: not_to` (default)
3234+
32333235
[source,ruby]
32343236
----
32353237
# bad
@@ -3243,6 +3245,21 @@ it '...' do
32433245
end
32443246
----
32453247

3248+
==== `EnforcedStyle: to_not`
3249+
3250+
[source,ruby]
3251+
----
3252+
# bad
3253+
it '...' do
3254+
expect(false).not_to be_true
3255+
end
3256+
3257+
# good
3258+
it '...' do
3259+
expect(false).to_not be_true
3260+
end
3261+
----
3262+
32463263
=== Configurable attributes
32473264

32483265
|===
@@ -3808,7 +3825,7 @@ expect(Foo).to receive(:bar) { "baz" }
38083825
allow(Foo).to receive(:bar).and_return(bar.baz)
38093826
----
38103827

3811-
==== `EnforcedStyle: and_return`
3828+
==== `EnforcedStyle: and_return` (default)
38123829

38133830
[source,ruby]
38143831
----

docs/modules/ROOT/pages/cops_rspec_factorybot.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ This cop can be configured using the `EnforcedStyle` option
6969

7070
=== Examples
7171

72-
==== `EnforcedStyle: create_list`
72+
==== `EnforcedStyle: create_list` (default)
7373

7474
[source,ruby]
7575
----

lib/rubocop/cop/rspec/described_class.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module RSpec
1111
# This cop can be configured using the `EnforcedStyle` and `SkipBlocks`
1212
# options.
1313
#
14-
# @example `EnforcedStyle: described_class`
14+
# @example `EnforcedStyle: described_class` (default)
1515
# # bad
1616
# describe MyClass do
1717
# subject { MyClass.do_something }

lib/rubocop/cop/rspec/example_without_description.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module RSpec
1414
#
1515
# This cop can be configured using the `EnforcedStyle` option
1616
#
17-
# @example `EnforcedStyle: always_allow`
17+
# @example `EnforcedStyle: always_allow` (default)
1818
# # bad
1919
# it('') { is_expected.to be_good }
2020
# it '' do

lib/rubocop/cop/rspec/expect_change.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module RSpec
1717
# # good
1818
# expect { run }.to change { Foo.bar }
1919
#
20-
# @example `EnforcedStyle: method_call`
20+
# @example `EnforcedStyle: method_call` (default)
2121
# # bad
2222
# expect { run }.to change { Foo.bar }
2323
# expect { run }.to change { foo.baz }

lib/rubocop/cop/rspec/factory_bot/create_list.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module FactoryBot
88
#
99
# This cop can be configured using the `EnforcedStyle` option
1010
#
11-
# @example `EnforcedStyle: create_list`
11+
# @example `EnforcedStyle: create_list` (default)
1212
# # bad
1313
# 3.times { create :user }
1414
#

lib/rubocop/cop/rspec/hook_argument.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module RSpec
1010
# styles: "implicit", "each", and "example." All styles have
1111
# the same behavior.
1212
#
13-
# @example when configuration is `EnforcedStyle: implicit`
13+
# @example `EnforcedStyle: implicit` (default)
1414
# # bad
1515
# before(:each) do
1616
# # ...
@@ -26,7 +26,7 @@ module RSpec
2626
# # ...
2727
# end
2828
#
29-
# @example when configuration is `EnforcedStyle: each`
29+
# @example `EnforcedStyle: each`
3030
# # bad
3131
# before(:example) do
3232
# # ...
@@ -42,7 +42,7 @@ module RSpec
4242
# # ...
4343
# end
4444
#
45-
# @example when configuration is `EnforcedStyle: example`
45+
# @example `EnforcedStyle: example`
4646
# # bad
4747
# before(:each) do
4848
# # ...

lib/rubocop/cop/rspec/implicit_expect.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module RSpec
88
# This cop can be configured using the `EnforcedStyle` option
99
# and supports the `--auto-gen-config` flag.
1010
#
11-
# @example `EnforcedStyle: is_expected`
11+
# @example `EnforcedStyle: is_expected` (default)
1212
#
1313
# # bad
1414
# it { should be_truthy }

lib/rubocop/cop/rspec/it_behaves_like.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ module Cop
55
module RSpec
66
# Checks that only one `it_behaves_like` style is used.
77
#
8-
# @example when configuration is `EnforcedStyle: it_behaves_like`
8+
# @example `EnforcedStyle: it_behaves_like` (default)
99
# # bad
1010
# it_should_behave_like 'a foo'
1111
#
1212
# # good
1313
# it_behaves_like 'a foo'
1414
#
15-
# @example when configuration is `EnforcedStyle: it_should_behave_like`
15+
# @example `EnforcedStyle: it_should_behave_like`
1616
# # bad
1717
# it_behaves_like 'a foo'
1818
#

lib/rubocop/cop/rspec/message_expectation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module RSpec
88
# This cop can be configured in your configuration using the
99
# `EnforcedStyle` option and supports `--auto-gen-config`.
1010
#
11-
# @example `EnforcedStyle: allow`
11+
# @example `EnforcedStyle: allow` (default)
1212
#
1313
# # bad
1414
# expect(foo).to receive(:bar)

0 commit comments

Comments
 (0)