rubocop-rspec 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/README.md +23 -0
  4. data/Rakefile +19 -1
  5. data/config/default.yml +78 -15
  6. data/lib/rubocop-rspec.rb +19 -1
  7. data/lib/rubocop/cop/rspec/any_instance.rb +5 -1
  8. data/lib/rubocop/cop/rspec/be_eql.rb +58 -0
  9. data/lib/rubocop/cop/rspec/describe_class.rb +2 -3
  10. data/lib/rubocop/cop/rspec/describe_method.rb +4 -3
  11. data/lib/rubocop/cop/rspec/described_class.rb +4 -35
  12. data/lib/rubocop/cop/rspec/empty_example_group.rb +100 -0
  13. data/lib/rubocop/cop/rspec/example_length.rb +5 -2
  14. data/lib/rubocop/cop/rspec/example_wording.rb +5 -2
  15. data/lib/rubocop/cop/rspec/expect_actual.rb +79 -0
  16. data/lib/rubocop/cop/rspec/file_path.rb +3 -1
  17. data/lib/rubocop/cop/rspec/focus.rb +12 -28
  18. data/lib/rubocop/cop/rspec/hook_argument.rb +122 -0
  19. data/lib/rubocop/cop/rspec/instance_variable.rb +53 -12
  20. data/lib/rubocop/cop/rspec/leading_subject.rb +58 -0
  21. data/lib/rubocop/cop/rspec/let_setup.rb +58 -0
  22. data/lib/rubocop/cop/rspec/message_chain.rb +33 -0
  23. data/lib/rubocop/cop/rspec/message_expectation.rb +58 -0
  24. data/lib/rubocop/cop/rspec/multiple_describes.rb +10 -7
  25. data/lib/rubocop/cop/rspec/multiple_expectations.rb +89 -0
  26. data/lib/rubocop/cop/rspec/named_subject.rb +10 -1
  27. data/lib/rubocop/cop/rspec/nested_groups.rb +125 -0
  28. data/lib/rubocop/cop/rspec/not_to_not.rb +3 -3
  29. data/lib/rubocop/cop/rspec/subject_stub.rb +136 -0
  30. data/lib/rubocop/cop/rspec/verified_doubles.rb +4 -1
  31. data/lib/rubocop/rspec.rb +10 -0
  32. data/lib/rubocop/rspec/config_formatter.rb +33 -0
  33. data/lib/rubocop/rspec/description_extractor.rb +35 -0
  34. data/lib/rubocop/rspec/inject.rb +2 -6
  35. data/lib/rubocop/rspec/language.rb +73 -0
  36. data/lib/rubocop/rspec/language/node_pattern.rb +16 -0
  37. data/lib/rubocop/rspec/spec_only.rb +61 -0
  38. data/lib/rubocop/rspec/top_level_describe.rb +6 -0
  39. data/lib/rubocop/rspec/version.rb +1 -1
  40. data/rubocop-rspec.gemspec +1 -0
  41. data/spec/project/changelog_spec.rb +81 -0
  42. data/spec/project/default_config_spec.rb +52 -0
  43. data/spec/project/project_requires_spec.rb +8 -0
  44. data/spec/rubocop/cop/rspec/be_eql_spec.rb +59 -0
  45. data/spec/rubocop/cop/rspec/described_class_spec.rb +2 -2
  46. data/spec/rubocop/cop/rspec/empty_example_group_spec.rb +79 -0
  47. data/spec/rubocop/cop/rspec/example_length_spec.rb +50 -30
  48. data/spec/rubocop/cop/rspec/example_wording_spec.rb +21 -3
  49. data/spec/rubocop/cop/rspec/expect_actual_spec.rb +136 -0
  50. data/spec/rubocop/cop/rspec/file_path_spec.rb +48 -71
  51. data/spec/rubocop/cop/rspec/focus_spec.rb +1 -1
  52. data/spec/rubocop/cop/rspec/hook_argument_spec.rb +189 -0
  53. data/spec/rubocop/cop/rspec/instance_variable_spec.rb +37 -0
  54. data/spec/rubocop/cop/rspec/leading_subject_spec.rb +54 -0
  55. data/spec/rubocop/cop/rspec/let_setup_spec.rb +66 -0
  56. data/spec/rubocop/cop/rspec/message_chain_spec.rb +21 -0
  57. data/spec/rubocop/cop/rspec/message_expectation_spec.rb +63 -0
  58. data/spec/rubocop/cop/rspec/multiple_expectations_spec.rb +84 -0
  59. data/spec/rubocop/cop/rspec/nested_groups_spec.rb +55 -0
  60. data/spec/rubocop/cop/rspec/not_to_not_spec.rb +12 -2
  61. data/spec/rubocop/cop/rspec/subject_stub_spec.rb +183 -0
  62. data/spec/rubocop/rspec/config_formatter_spec.rb +48 -0
  63. data/spec/rubocop/rspec/description_extractor_spec.rb +35 -0
  64. data/spec/rubocop/rspec/language/selector_set_spec.rb +29 -0
  65. data/spec/rubocop/rspec/spec_only_spec.rb +97 -0
  66. data/spec/shared/rspec_only_cop_behavior.rb +68 -0
  67. data/spec/spec_helper.rb +13 -1
  68. metadata +72 -5
  69. data/spec/project_spec.rb +0 -115
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82d2c8c126eff832fb8c23b6a53a3e0d1a7e4f9c
4
- data.tar.gz: c02b0c96893e673c18b0480f8e2755023ecb6987
3
+ metadata.gz: cc482ce2af79693a4824889cb1f4e418936466f9
4
+ data.tar.gz: f0f1ff329a1a1cf4642f38c64258370ae4b269f6
5
5
  SHA512:
6
- metadata.gz: 1d6c8e1aeaa1e02427d474c2000c3cc50094746cf85e86a98965e1041aafb7b2be35e25616cce96b69f6a6803b2d1679e31647d112ea6e819267bfde52f24cb6
7
- data.tar.gz: 643ac89c40e06801a88c7b19d49ee9109389f9a574717f9aee9ca527e48c38f0a95f8586979eecf5d9f26161a5ef3a0a502a1870c7a7fac62ed0ac96fd6b5140
6
+ metadata.gz: 871f9e04aaa056cbe3d0b3b73ef22b0ebcf6b1d2c242d94dc823e73a5b93a87683ffc24844a81bfe82849a85baf66d27800a07c7e069b62329da563c3467ef46
7
+ data.tar.gz: 866bf67d2e134be5e153ad066f7c6c04eec42647e2aad769745a4a4708005a93a437cf0427389170a57c00463bd02a66a05995e5d1f5362cfb38d0d7c025c8c6
data/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  ## Master (unreleased)
4
4
 
5
+ ## 1.7.0 (2016-08-24)
6
+
7
+ * Add support for checking all example groups with `ExampleLength`. ([@backus][])
8
+ * Add support for checking shared example groups for `DescribedClass`. ([@backus][])
9
+ * Add support for checking `its` from [rspec-its](https://github.com/rspec/rspec-its). ([@backus][])
10
+ * Add `EmptyExampleGroup` cop for detecting `describe`s and `context`s without any tests inside. ([@backus][])
11
+ * Add `CustomIncludeMethods` configuration option for `EmptyExampleGroup`. ([@backus][])
12
+ * Add `NestedGroups` cop for detecting excessive example group nesting. ([@backus][])
13
+ * Add `MaxNesting` configuration option for `NestedGroups` cop. ([@backus][])
14
+ * Add `ExpectActual` cop for detecting literal values within `expect(...)`. ([@backus][])
15
+ * Add `MultipleExpectations` cop for detecting multiple `expect(...)` calls within one example. ([@backus][])
16
+ * Add `Max` configuration option for `MultipleExpectations`. ([@backus][])
17
+ * Add `SubjectStub` cop for testing stubbed test subjects. ([@backus][])
18
+ * Add `LetSetup` cop for detecting cases where `let!` is used for test setup. ([@backus][])
19
+ * Change all cops to only inspect files with names following rspec convention (`*/spec/*` and/or `_spec.rb`). ([@backus][])
20
+ * Add `AllCops/RSpec` configuration option for specifying custom spec file patterns. ([@backus][])
21
+ * Add `AssignmentOnly` configuration option for `RSpec/InstanceVariable` cop. ([@backus][])
22
+ * Add `BeEql` cop which looks for expectations that can use `be(...)` instead of `eql(...)`. ([@backus][])
23
+ * Add autocorrect support for `BeEql` cop. ([@backus][])
24
+ * Add `MessageExpectation` cop for enforcing consistent style of either `expect(...).to receive` or `allow(...).to receive`. ([@backus][])
25
+ * Add `MessageChain` cop. ([@bquorning][])
26
+
5
27
  ## 1.6.0 (2016-08-03)
6
28
 
7
29
  * Add `SkipBlocks` option for `DescribedClass` cop. ([@backus][])
data/README.md CHANGED
@@ -55,6 +55,29 @@ RuboCop::RakeTask.new do |task|
55
55
  end
56
56
  ```
57
57
 
58
+ ### Code Climate
59
+
60
+ rubocop-rspec is available on Code Climate as part of the rubocop engine. [Learn More](https://codeclimate.com/changelog/55a433bbe30ba00852000fac).
61
+
62
+ ## Inspecting files that don't end with `_spec.rb`
63
+
64
+ By default, `rubocop-rspec` only inspects code within paths ending in `_spec.rb` or including `spec/`. You can override this setting in your config file by specifying one or more patterns:
65
+
66
+ ```yaml
67
+ # Inspect all files
68
+ AllCops:
69
+ RSpec:
70
+ Patterns:
71
+ - '.+'
72
+ ```
73
+
74
+ ```yaml
75
+ # Inspect only files ending with `_test.rb`
76
+ AllCops:
77
+ RSpec:
78
+ Patterns:
79
+ - '_test.rb$'
80
+ ```
58
81
 
59
82
  ## The Cops
60
83
 
data/Rakefile CHANGED
@@ -1,5 +1,8 @@
1
+ require 'open3'
2
+
1
3
  require 'bundler'
2
4
  require 'bundler/gem_tasks'
5
+
3
6
  begin
4
7
  Bundler.setup(:default, :development)
5
8
  rescue Bundler::BundlerError => e
@@ -27,4 +30,19 @@ task :internal_investigation do
27
30
  abort('RuboCop failed!') unless result.zero?
28
31
  end
29
32
 
30
- task default: [:spec, :internal_investigation]
33
+ desc 'Build config/default.yml'
34
+ task :build_config do
35
+ sh('bin/build_config')
36
+ end
37
+
38
+ desc 'Confirm config/default.yml is up to date'
39
+ task confirm_config: :build_config do
40
+ _, stdout, _, process =
41
+ Open3.popen3('git diff --exit-code config/default.yml')
42
+
43
+ unless process.value.success?
44
+ raise "default.yml is out of sync:\n\n#{stdout.read}\nRun bin/build_config"
45
+ end
46
+ end
47
+
48
+ task default: [:build_config, :spec, :internal_investigation, :confirm_config]
data/config/default.yml CHANGED
@@ -1,22 +1,42 @@
1
+ ---
2
+ AllCops:
3
+ RSpec:
4
+ Patterns:
5
+ - _spec.rb
6
+ - "(?:^|/)spec/"
7
+
1
8
  RSpec/AnyInstance:
2
- Description: 'Check that instances are not being stubbed globally'
9
+ Description: Check that instances are not being stubbed globally.
10
+ Enabled: true
11
+
12
+ RSpec/BeEql:
13
+ Description: Check for expectations where `be(...)` can replace `eql(...)`.
3
14
  Enabled: true
4
15
 
16
+ RSpec/HookArgument:
17
+ Description: Checks the arguments passed to `before`, `around`, and `after`.
18
+ Enabled: true
19
+ EnforcedStyle: implicit
20
+ SupportedStyles:
21
+ - implicit
22
+ - each
23
+ - example
24
+
5
25
  RSpec/DescribeClass:
6
- Description: 'Check that the first argument to the top level describe is the tested class or module.'
26
+ Description: Check that the first argument to the top level describe is a constant.
7
27
  Enabled: true
8
28
 
9
29
  RSpec/DescribedClass:
10
- Description: 'Use `described_class` for tested class / module'
30
+ Description: Checks that tests use `described_class`.
11
31
  SkipBlocks: false
12
32
  Enabled: true
13
33
 
14
34
  RSpec/DescribeMethod:
15
- Description: 'Checks that the second argument to top level describe is the tested method name.'
35
+ Description: Checks that the second argument to `describe` specifies a method.
16
36
  Enabled: true
17
37
 
18
38
  RSpec/ExampleWording:
19
- Description: 'Do not use should when describing your tests.'
39
+ Description: Checks that example descriptions do not start with "should".
20
40
  Enabled: true
21
41
  CustomTransform:
22
42
  be: is
@@ -24,44 +44,87 @@ RSpec/ExampleWording:
24
44
  not: does not
25
45
  IgnoredWords: []
26
46
 
47
+ RSpec/EmptyExampleGroup:
48
+ Description: Checks if an example group does not include any tests.
49
+ Enabled: true
50
+ CustomIncludeMethods: []
51
+
52
+ RSpec/ExpectActual:
53
+ Description: Checks for `expect(...)` calls containing literal values.
54
+ Enabled: true
55
+
56
+ RSpec/MessageChain:
57
+ Description: Check that chains of messages are not being stubbed.
58
+ Enabled: true
27
59
 
28
60
  RSpec/MultipleDescribes:
29
- Description: 'Checks for multiple top level describes.'
61
+ Description: Checks for multiple top level describes.
62
+ Enabled: true
63
+
64
+ RSpec/MultipleExpectations:
65
+ Description: Checks if examples contain too many `expect` calls.
66
+ Enabled: true
67
+ Max: 1
68
+
69
+ RSpec/NestedGroups:
70
+ Description: Checks for nested example groups.
30
71
  Enabled: true
72
+ MaxNesting: 2
31
73
 
32
74
  RSpec/InstanceVariable:
33
- Description: 'Checks for the usage of instance variables.'
75
+ Description: Checks for instance variable usage in specs.
76
+ AssignmentOnly: false
77
+ Enabled: true
78
+
79
+ RSpec/LetSetup:
80
+ Description: Checks unreferenced `let!` calls being used for test setup.
81
+ Enabled: true
82
+
83
+ RSpec/LeadingSubject:
84
+ Description: Checks for `subject` definitions that come after `let` definitions.
34
85
  Enabled: true
35
86
 
36
87
  RSpec/FilePath:
37
- Description: 'Checks the file and folder naming of the spec file.'
88
+ Description: Checks that spec file paths are consistent with the test subject.
38
89
  Enabled: true
39
90
  CustomTransform:
40
91
  RuboCop: rubocop
41
92
  RSpec: rspec
42
93
 
43
94
  RSpec/VerifiedDoubles:
44
- Description: 'Prefer using verifying doubles over normal doubles.'
95
+ Description: Prefer using verifying doubles over normal doubles.
45
96
  Enabled: true
46
97
  IgnoreSymbolicNames: false
47
98
 
48
99
  RSpec/NotToNot:
49
- Description: 'Enforces the usage of the same method on all negative message expectations.'
100
+ Description: Checks for consistent method usage for negating expectations.
50
101
  EnforcedStyle: not_to
51
102
  SupportedStyles:
52
- - not_to
53
- - to_not
103
+ - not_to
104
+ - to_not
54
105
  Enabled: true
55
106
 
56
107
  RSpec/Focus:
57
- Description: 'Checks if there are focused specs.'
108
+ Description: Checks if examples are focused.
58
109
  Enabled: true
59
110
 
60
111
  RSpec/ExampleLength:
61
- Description: 'Checks for long example'
112
+ Description: Checks for long examples.
62
113
  Enabled: true
63
114
  Max: 5
64
115
 
116
+ RSpec/MessageExpectation:
117
+ Description: Checks for consistent message expectation style.
118
+ Enabled: true
119
+ EnforcedStyle: allow
120
+ SupportedStyles:
121
+ - allow
122
+ - expect
123
+
65
124
  RSpec/NamedSubject:
66
- Description: 'Name your RSpec subject if you reference it explicitly'
125
+ Description: Checks for explicitly referenced test subjects.
126
+ Enabled: true
127
+
128
+ RSpec/SubjectStub:
129
+ Description: Checks for stubbed test subjects.
67
130
  Enabled: true
data/lib/rubocop-rspec.rb CHANGED
@@ -1,24 +1,42 @@
1
+ require 'pathname'
2
+ require 'yaml'
3
+
1
4
  require 'rubocop'
2
5
 
6
+ require 'rubocop/rspec'
3
7
  require 'rubocop/rspec/version'
4
8
  require 'rubocop/rspec/inject'
5
9
  require 'rubocop/rspec/top_level_describe'
6
10
  require 'rubocop/rspec/wording'
7
11
  require 'rubocop/rspec/util'
12
+ require 'rubocop/rspec/language'
13
+ require 'rubocop/rspec/language/node_pattern'
14
+ require 'rubocop/rspec/spec_only'
8
15
 
9
16
  RuboCop::RSpec::Inject.defaults!
10
17
 
11
18
  # cops
12
19
  require 'rubocop/cop/rspec/any_instance'
20
+ require 'rubocop/cop/rspec/be_eql'
13
21
  require 'rubocop/cop/rspec/describe_class'
14
22
  require 'rubocop/cop/rspec/describe_method'
15
23
  require 'rubocop/cop/rspec/described_class'
24
+ require 'rubocop/cop/rspec/empty_example_group'
25
+ require 'rubocop/cop/rspec/example_length'
16
26
  require 'rubocop/cop/rspec/example_wording'
27
+ require 'rubocop/cop/rspec/expect_actual'
17
28
  require 'rubocop/cop/rspec/file_path'
18
29
  require 'rubocop/cop/rspec/focus'
30
+ require 'rubocop/cop/rspec/hook_argument'
19
31
  require 'rubocop/cop/rspec/instance_variable'
20
- require 'rubocop/cop/rspec/example_length'
32
+ require 'rubocop/cop/rspec/leading_subject'
33
+ require 'rubocop/cop/rspec/let_setup'
34
+ require 'rubocop/cop/rspec/message_chain'
35
+ require 'rubocop/cop/rspec/message_expectation'
21
36
  require 'rubocop/cop/rspec/multiple_describes'
37
+ require 'rubocop/cop/rspec/multiple_expectations'
22
38
  require 'rubocop/cop/rspec/named_subject'
39
+ require 'rubocop/cop/rspec/nested_groups'
23
40
  require 'rubocop/cop/rspec/not_to_not'
41
+ require 'rubocop/cop/rspec/subject_stub'
24
42
  require 'rubocop/cop/rspec/verified_doubles'
@@ -1,7 +1,9 @@
1
1
  module RuboCop
2
2
  module Cop
3
3
  module RSpec
4
- # Pefer instance doubles over stubbing any instance of a class
4
+ # Check that instances are not being stubbed globally.
5
+ #
6
+ # Prefer instance doubles over stubbing any instance of a class
5
7
  #
6
8
  # @example
7
9
  # # bad
@@ -19,6 +21,8 @@ module RuboCop
19
21
  # end
20
22
  # end
21
23
  class AnyInstance < Cop
24
+ include RuboCop::RSpec::SpecOnly
25
+
22
26
  MESSAGE = 'Avoid stubbing using `%{method}`'.freeze
23
27
 
24
28
  ANY_INSTANCE_METHODS = [
@@ -0,0 +1,58 @@
1
+ module RuboCop
2
+ module Cop
3
+ module RSpec
4
+ # Check for expectations where `be(...)` can replace `eql(...)`.
5
+ #
6
+ # The `be` matcher compares by identity while the `eql` matcher
7
+ # compares using `eql?`. Integers, floats, booleans, and symbols
8
+ # can be compared by identity and therefore the `be` matcher is
9
+ # preferable as it is a more strict test.
10
+ #
11
+ # @example
12
+ #
13
+ # # bad
14
+ # expect(foo).to eql(1)
15
+ # expect(foo).to eql(1.0)
16
+ # expect(foo).to eql(true)
17
+ # expect(foo).to eql(false)
18
+ # expect(foo).to eql(:bar)
19
+ #
20
+ # # good
21
+ # expect(foo).to be(1)
22
+ # expect(foo).to be(1.0)
23
+ # expect(foo).to be(true)
24
+ # expect(foo).to be(false)
25
+ # expect(foo).to be(:bar)
26
+ #
27
+ # This cop only looks for instances of `expect(...).to eql(...)`. We
28
+ # do not check `to_not` or `not_to` since `!eql?` is more strict
29
+ # than `!equal?`. We also do not try to flag `eq` because if
30
+ # `a == b`, and `b` is comparable by identity, `a` is still not
31
+ # necessarily the same type as `b` since the `#==` operator can
32
+ # coerce objects for comparison.
33
+ #
34
+ class BeEql < Cop
35
+ include RuboCop::RSpec::SpecOnly,
36
+ RuboCop::Cop::ConfigurableEnforcedStyle
37
+
38
+ MSG = 'Prefer `be` over `eql`'.freeze
39
+
40
+ def_node_matcher :eql_type_with_identity, <<-PATTERN
41
+ (send _ :to $(send nil :eql {true false int float sym}))
42
+ PATTERN
43
+
44
+ def on_send(node)
45
+ eql_type_with_identity(node) do |eql|
46
+ add_offense(eql, :selector, MSG)
47
+ end
48
+ end
49
+
50
+ def autocorrect(node)
51
+ lambda do |corrector|
52
+ corrector.replace(node.loc.selector, 'be')
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -3,8 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module RSpec
6
- # Check that the first argument to the top level describe is the tested
7
- # class or module.
6
+ # Check that the first argument to the top level describe is a constant.
8
7
  #
9
8
  # @example
10
9
  # # bad
@@ -18,7 +17,7 @@ module RuboCop
18
17
  # describe "A feature example", type: :feature do
19
18
  # end
20
19
  class DescribeClass < Cop
21
- include RuboCop::RSpec::TopLevelDescribe
20
+ include RuboCop::RSpec::SpecOnly, RuboCop::RSpec::TopLevelDescribe
22
21
 
23
22
  MSG = 'The first argument to describe should be '\
24
23
  'the class or module being tested.'.freeze
@@ -3,8 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module RSpec
6
- # Checks that the second argument to the top level describe is the tested
7
- # method name.
6
+ # Checks that the second argument to `describe` specifies a method.
8
7
  #
9
8
  # @example
10
9
  # # bad
@@ -18,7 +17,9 @@ module RuboCop
18
17
  # describe MyClass, '.my_class_method' do
19
18
  # end
20
19
  class DescribeMethod < Cop
21
- include RuboCop::RSpec::TopLevelDescribe, RuboCop::RSpec::Util
20
+ include RuboCop::RSpec::SpecOnly,
21
+ RuboCop::RSpec::TopLevelDescribe,
22
+ RuboCop::RSpec::Util
22
23
 
23
24
  MESSAGE = 'The second argument to describe should be the method ' \
24
25
  "being tested. '#instance' or '.class'".freeze
@@ -3,6 +3,8 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module RSpec
6
+ # Checks that tests use `described_class`.
7
+ #
6
8
  # If the first argument of describe is a class, the class is exposed to
7
9
  # each example via described_class - this should be used instead of
8
10
  # repeating the class.
@@ -18,45 +20,12 @@ module RuboCop
18
20
  # subject { described_class.do_something }
19
21
  # end
20
22
  class DescribedClass < Cop
21
- include RuboCop::RSpec::TopLevelDescribe
23
+ include RuboCop::RSpec::SpecOnly, RuboCop::RSpec::TopLevelDescribe
22
24
 
23
25
  DESCRIBED_CLASS = 'described_class'.freeze
24
26
  MSG = "Use `#{DESCRIBED_CLASS}` instead of `%s`".freeze
25
27
 
26
- RSPEC_BLOCK_METHODS = '
27
- :after
28
- :around
29
- :before
30
- :context
31
- :describe
32
- :example
33
- :example_group
34
- :fcontext
35
- :fdescribe
36
- :feature
37
- :fexample
38
- :ffeature
39
- :fit
40
- :focus
41
- :fscenario
42
- :fspecify
43
- :it
44
- :let
45
- :let!
46
- :scenario
47
- :specify
48
- :xcontext
49
- :xdescribe
50
- :xexample
51
- :xfeature
52
- :xit
53
- :xscenario
54
- :xspecify
55
- '.freeze
56
-
57
- def_node_matcher :described_constant, <<-PATTERN
58
- (block $(send _ :describe $(const ...)) (args) $_)
59
- PATTERN
28
+ RSPEC_BLOCK_METHODS = RuboCop::RSpec::Language::ALL.to_node_pattern
60
29
 
61
30
  def_node_matcher :common_instance_exec_closure?, <<-PATTERN
62
31
  (block (send (const nil {:Class :Module}) :new ...) ...)