rubocop-rspec 1.38.1 → 1.43.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -0
  3. data/CODE_OF_CONDUCT.md +17 -0
  4. data/README.md +1 -61
  5. data/config/default.yml +159 -19
  6. data/lib/rubocop-rspec.rb +5 -2
  7. data/lib/rubocop/cop/rspec/align_left_let_brace.rb +12 -19
  8. data/lib/rubocop/cop/rspec/align_right_let_brace.rb +12 -19
  9. data/lib/rubocop/cop/rspec/any_instance.rb +1 -1
  10. data/lib/rubocop/cop/rspec/around_block.rb +1 -1
  11. data/lib/rubocop/cop/rspec/base.rb +74 -0
  12. data/lib/rubocop/cop/rspec/be.rb +2 -2
  13. data/lib/rubocop/cop/rspec/be_eql.rb +6 -6
  14. data/lib/rubocop/cop/rspec/before_after_all.rb +1 -1
  15. data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +19 -17
  16. data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +14 -12
  17. data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +69 -0
  18. data/lib/rubocop/cop/rspec/context_method.rb +7 -9
  19. data/lib/rubocop/cop/rspec/context_wording.rb +3 -3
  20. data/lib/rubocop/cop/rspec/cop.rb +3 -87
  21. data/lib/rubocop/cop/rspec/describe_class.rb +29 -23
  22. data/lib/rubocop/cop/rspec/describe_method.rb +14 -7
  23. data/lib/rubocop/cop/rspec/describe_symbol.rb +2 -2
  24. data/lib/rubocop/cop/rspec/described_class.rb +12 -9
  25. data/lib/rubocop/cop/rspec/described_class_module_wrapping.rb +1 -1
  26. data/lib/rubocop/cop/rspec/dialect.rb +5 -12
  27. data/lib/rubocop/cop/rspec/empty_example_group.rb +91 -7
  28. data/lib/rubocop/cop/rspec/empty_hook.rb +46 -0
  29. data/lib/rubocop/cop/rspec/empty_line_after_example.rb +5 -7
  30. data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +5 -9
  31. data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +8 -8
  32. data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +5 -9
  33. data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +6 -6
  34. data/lib/rubocop/cop/rspec/example_length.rb +1 -1
  35. data/lib/rubocop/cop/rspec/example_without_description.rb +1 -1
  36. data/lib/rubocop/cop/rspec/example_wording.rb +10 -11
  37. data/lib/rubocop/cop/rspec/expect_actual.rb +8 -11
  38. data/lib/rubocop/cop/rspec/expect_change.rb +10 -35
  39. data/lib/rubocop/cop/rspec/expect_in_hook.rb +3 -3
  40. data/lib/rubocop/cop/rspec/expect_output.rb +2 -2
  41. data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +24 -21
  42. data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +20 -22
  43. data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +7 -8
  44. data/lib/rubocop/cop/rspec/file_path.rb +57 -21
  45. data/lib/rubocop/cop/rspec/focus.rb +7 -11
  46. data/lib/rubocop/cop/rspec/hook_argument.rb +16 -23
  47. data/lib/rubocop/cop/rspec/hooks_before_examples.rb +10 -29
  48. data/lib/rubocop/cop/rspec/implicit_block_expectation.rb +1 -1
  49. data/lib/rubocop/cop/rspec/implicit_expect.rb +7 -15
  50. data/lib/rubocop/cop/rspec/implicit_subject.rb +16 -11
  51. data/lib/rubocop/cop/rspec/instance_spy.rb +18 -12
  52. data/lib/rubocop/cop/rspec/instance_variable.rb +4 -8
  53. data/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb +3 -6
  54. data/lib/rubocop/cop/rspec/it_behaves_like.rb +5 -6
  55. data/lib/rubocop/cop/rspec/iterated_expectation.rb +1 -1
  56. data/lib/rubocop/cop/rspec/leading_subject.rb +22 -26
  57. data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +2 -5
  58. data/lib/rubocop/cop/rspec/let_before_examples.rb +10 -26
  59. data/lib/rubocop/cop/rspec/let_setup.rb +21 -6
  60. data/lib/rubocop/cop/rspec/message_chain.rb +7 -6
  61. data/lib/rubocop/cop/rspec/message_expectation.rb +2 -2
  62. data/lib/rubocop/cop/rspec/message_spies.rb +2 -3
  63. data/lib/rubocop/cop/rspec/missing_example_group_argument.rb +1 -1
  64. data/lib/rubocop/cop/rspec/multiple_describes.rb +11 -8
  65. data/lib/rubocop/cop/rspec/multiple_expectations.rb +7 -11
  66. data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +148 -0
  67. data/lib/rubocop/cop/rspec/multiple_subjects.rb +18 -19
  68. data/lib/rubocop/cop/rspec/named_subject.rb +8 -8
  69. data/lib/rubocop/cop/rspec/nested_groups.rb +12 -13
  70. data/lib/rubocop/cop/rspec/not_to_not.rb +5 -6
  71. data/lib/rubocop/cop/rspec/overwriting_setup.rb +1 -1
  72. data/lib/rubocop/cop/rspec/pending.rb +1 -1
  73. data/lib/rubocop/cop/rspec/predicate_matcher.rb +32 -69
  74. data/lib/rubocop/cop/rspec/rails/http_status.rb +7 -9
  75. data/lib/rubocop/cop/rspec/receive_counts.rb +15 -17
  76. data/lib/rubocop/cop/rspec/receive_never.rb +12 -12
  77. data/lib/rubocop/cop/rspec/repeated_description.rb +1 -1
  78. data/lib/rubocop/cop/rspec/repeated_example.rb +2 -2
  79. data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +12 -2
  80. data/lib/rubocop/cop/rspec/repeated_example_group_description.rb +1 -1
  81. data/lib/rubocop/cop/rspec/return_from_stub.rb +12 -22
  82. data/lib/rubocop/cop/rspec/scattered_let.rb +12 -2
  83. data/lib/rubocop/cop/rspec/scattered_setup.rb +1 -1
  84. data/lib/rubocop/cop/rspec/shared_context.rb +8 -21
  85. data/lib/rubocop/cop/rspec/shared_examples.rb +7 -9
  86. data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +15 -18
  87. data/lib/rubocop/cop/rspec/subject_stub.rb +25 -53
  88. data/lib/rubocop/cop/rspec/unspecified_exception.rb +1 -1
  89. data/lib/rubocop/cop/rspec/variable_definition.rb +56 -0
  90. data/lib/rubocop/cop/rspec/variable_name.rb +66 -0
  91. data/lib/rubocop/cop/rspec/verified_doubles.rb +1 -1
  92. data/lib/rubocop/cop/rspec/void_expect.rb +1 -1
  93. data/lib/rubocop/cop/rspec/yield.rb +14 -11
  94. data/lib/rubocop/cop/rspec_cops.rb +6 -1
  95. data/lib/rubocop/rspec/corrector/move_node.rb +54 -0
  96. data/lib/rubocop/rspec/description_extractor.rb +2 -6
  97. data/lib/rubocop/rspec/{blank_line_separation.rb → empty_line_separation.rb} +13 -10
  98. data/lib/rubocop/rspec/example_group.rb +21 -49
  99. data/lib/rubocop/rspec/factory_bot.rb +7 -1
  100. data/lib/rubocop/rspec/language.rb +13 -3
  101. data/lib/rubocop/rspec/language/node_pattern.rb +11 -2
  102. data/lib/rubocop/rspec/top_level_describe.rb +2 -2
  103. data/lib/rubocop/rspec/top_level_group.rb +55 -0
  104. data/lib/rubocop/rspec/variable.rb +16 -0
  105. data/lib/rubocop/rspec/version.rb +1 -1
  106. metadata +36 -13
  107. data/lib/rubocop/rspec/util.rb +0 -19
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module RSpec
5
+ # Helps check offenses with variable definitions
6
+ module Variable
7
+ include Language
8
+ extend RuboCop::NodePattern::Macros
9
+
10
+ def_node_matcher :variable_definition?, <<~PATTERN
11
+ (send nil? #{(Helpers::ALL + Subject::ALL).node_pattern_union}
12
+ $({sym str dsym dstr} ...) ...)
13
+ PATTERN
14
+ end
15
+ end
16
+ end
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module RSpec
5
5
  # Version information for the RSpec RuboCop plugin.
6
6
  module Version
7
- STRING = '1.38.1'
7
+ STRING = '1.43.0'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,31 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.38.1
4
+ version: 1.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Backus
8
8
  - Ian MacLeod
9
9
  - Nils Gemeinhardt
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-02-15 00:00:00.000000000 Z
13
+ date: 2020-08-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ">="
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: 0.68.1
21
+ version: '0.87'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ">="
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: 0.68.1
28
+ version: '0.87'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rack
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -68,6 +68,20 @@ dependencies:
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '3.4'
71
+ - !ruby/object:Gem::Dependency
72
+ name: rubocop-performance
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '1.7'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: '1.7'
71
85
  - !ruby/object:Gem::Dependency
72
86
  name: simplecov
73
87
  requirement: !ruby/object:Gem::Requirement
@@ -110,6 +124,7 @@ extra_rdoc_files:
110
124
  - README.md
111
125
  files:
112
126
  - CHANGELOG.md
127
+ - CODE_OF_CONDUCT.md
113
128
  - MIT-LICENSE.md
114
129
  - README.md
115
130
  - config/default.yml
@@ -118,11 +133,13 @@ files:
118
133
  - lib/rubocop/cop/rspec/align_right_let_brace.rb
119
134
  - lib/rubocop/cop/rspec/any_instance.rb
120
135
  - lib/rubocop/cop/rspec/around_block.rb
136
+ - lib/rubocop/cop/rspec/base.rb
121
137
  - lib/rubocop/cop/rspec/be.rb
122
138
  - lib/rubocop/cop/rspec/be_eql.rb
123
139
  - lib/rubocop/cop/rspec/before_after_all.rb
124
140
  - lib/rubocop/cop/rspec/capybara/current_path_expectation.rb
125
141
  - lib/rubocop/cop/rspec/capybara/feature_methods.rb
142
+ - lib/rubocop/cop/rspec/capybara/visibility_matcher.rb
126
143
  - lib/rubocop/cop/rspec/context_method.rb
127
144
  - lib/rubocop/cop/rspec/context_wording.rb
128
145
  - lib/rubocop/cop/rspec/cop.rb
@@ -133,6 +150,7 @@ files:
133
150
  - lib/rubocop/cop/rspec/described_class_module_wrapping.rb
134
151
  - lib/rubocop/cop/rspec/dialect.rb
135
152
  - lib/rubocop/cop/rspec/empty_example_group.rb
153
+ - lib/rubocop/cop/rspec/empty_hook.rb
136
154
  - lib/rubocop/cop/rspec/empty_line_after_example.rb
137
155
  - lib/rubocop/cop/rspec/empty_line_after_example_group.rb
138
156
  - lib/rubocop/cop/rspec/empty_line_after_final_let.rb
@@ -170,6 +188,7 @@ files:
170
188
  - lib/rubocop/cop/rspec/missing_example_group_argument.rb
171
189
  - lib/rubocop/cop/rspec/multiple_describes.rb
172
190
  - lib/rubocop/cop/rspec/multiple_expectations.rb
191
+ - lib/rubocop/cop/rspec/multiple_memoized_helpers.rb
173
192
  - lib/rubocop/cop/rspec/multiple_subjects.rb
174
193
  - lib/rubocop/cop/rspec/named_subject.rb
175
194
  - lib/rubocop/cop/rspec/nested_groups.rb
@@ -192,16 +211,19 @@ files:
192
211
  - lib/rubocop/cop/rspec/single_argument_message_chain.rb
193
212
  - lib/rubocop/cop/rspec/subject_stub.rb
194
213
  - lib/rubocop/cop/rspec/unspecified_exception.rb
214
+ - lib/rubocop/cop/rspec/variable_definition.rb
215
+ - lib/rubocop/cop/rspec/variable_name.rb
195
216
  - lib/rubocop/cop/rspec/verified_doubles.rb
196
217
  - lib/rubocop/cop/rspec/void_expect.rb
197
218
  - lib/rubocop/cop/rspec/yield.rb
198
219
  - lib/rubocop/cop/rspec_cops.rb
199
220
  - lib/rubocop/rspec.rb
200
221
  - lib/rubocop/rspec/align_let_brace.rb
201
- - lib/rubocop/rspec/blank_line_separation.rb
202
222
  - lib/rubocop/rspec/concept.rb
203
223
  - lib/rubocop/rspec/config_formatter.rb
224
+ - lib/rubocop/rspec/corrector/move_node.rb
204
225
  - lib/rubocop/rspec/description_extractor.rb
226
+ - lib/rubocop/rspec/empty_line_separation.rb
205
227
  - lib/rubocop/rspec/example.rb
206
228
  - lib/rubocop/rspec/example_group.rb
207
229
  - lib/rubocop/rspec/factory_bot.rb
@@ -212,7 +234,8 @@ files:
212
234
  - lib/rubocop/rspec/language/node_pattern.rb
213
235
  - lib/rubocop/rspec/node.rb
214
236
  - lib/rubocop/rspec/top_level_describe.rb
215
- - lib/rubocop/rspec/util.rb
237
+ - lib/rubocop/rspec/top_level_group.rb
238
+ - lib/rubocop/rspec/variable.rb
216
239
  - lib/rubocop/rspec/version.rb
217
240
  - lib/rubocop/rspec/wording.rb
218
241
  homepage: https://github.com/rubocop-hq/rubocop-rspec
@@ -221,7 +244,7 @@ licenses:
221
244
  metadata:
222
245
  changelog_uri: https://github.com/rubocop-hq/rubocop-rspec/blob/master/CHANGELOG.md
223
246
  documentation_uri: https://rubocop-rspec.readthedocs.io/
224
- post_install_message:
247
+ post_install_message:
225
248
  rdoc_options: []
226
249
  require_paths:
227
250
  - lib
@@ -229,15 +252,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
252
  requirements:
230
253
  - - ">="
231
254
  - !ruby/object:Gem::Version
232
- version: 2.3.0
255
+ version: 2.4.0
233
256
  required_rubygems_version: !ruby/object:Gem::Requirement
234
257
  requirements:
235
258
  - - ">="
236
259
  - !ruby/object:Gem::Version
237
260
  version: '0'
238
261
  requirements: []
239
- rubygems_version: 3.1.1
240
- signing_key:
262
+ rubygems_version: 3.0.3
263
+ signing_key:
241
264
  specification_version: 4
242
265
  summary: Code style checking for RSpec files
243
266
  test_files: []
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module RSpec
5
- # Utility methods
6
- module Util
7
- # Error raised by `Util.one` if size is less than zero or greater than one
8
- SizeError = Class.new(IndexError)
9
-
10
- # Return only element in array if it contains exactly one member
11
- def one(array)
12
- return array.first if array.one?
13
-
14
- raise SizeError,
15
- "expected size to be exactly 1 but size was #{array.size}"
16
- end
17
- end
18
- end
19
- end