rubocop-rspec 1.38.0 → 1.42.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -0
  3. data/CODE_OF_CONDUCT.md +17 -0
  4. data/README.md +1 -61
  5. data/config/default.yml +147 -17
  6. data/lib/rubocop-rspec.rb +3 -1
  7. data/lib/rubocop/cop/rspec/align_left_let_brace.rb +11 -18
  8. data/lib/rubocop/cop/rspec/align_right_let_brace.rb +11 -18
  9. data/lib/rubocop/cop/rspec/be.rb +1 -1
  10. data/lib/rubocop/cop/rspec/be_eql.rb +5 -5
  11. data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +18 -16
  12. data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +8 -9
  13. data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +69 -0
  14. data/lib/rubocop/cop/rspec/context_method.rb +5 -7
  15. data/lib/rubocop/cop/rspec/cop.rb +9 -29
  16. data/lib/rubocop/cop/rspec/describe_class.rb +20 -5
  17. data/lib/rubocop/cop/rspec/describe_method.rb +0 -1
  18. data/lib/rubocop/cop/rspec/described_class.rb +10 -7
  19. data/lib/rubocop/cop/rspec/dialect.rb +4 -11
  20. data/lib/rubocop/cop/rspec/empty_hook.rb +46 -0
  21. data/lib/rubocop/cop/rspec/empty_line_after_example.rb +5 -3
  22. data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +5 -5
  23. data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +4 -1
  24. data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +5 -5
  25. data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +4 -1
  26. data/lib/rubocop/cop/rspec/example_wording.rb +6 -7
  27. data/lib/rubocop/cop/rspec/expect_actual.rb +7 -10
  28. data/lib/rubocop/cop/rspec/expect_change.rb +9 -34
  29. data/lib/rubocop/cop/rspec/expect_in_hook.rb +2 -2
  30. data/lib/rubocop/cop/rspec/expect_output.rb +1 -1
  31. data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +23 -20
  32. data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +10 -16
  33. data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +6 -7
  34. data/lib/rubocop/cop/rspec/file_path.rb +32 -4
  35. data/lib/rubocop/cop/rspec/hook_argument.rb +11 -17
  36. data/lib/rubocop/cop/rspec/hooks_before_examples.rb +9 -28
  37. data/lib/rubocop/cop/rspec/implicit_expect.rb +6 -14
  38. data/lib/rubocop/cop/rspec/implicit_subject.rb +8 -5
  39. data/lib/rubocop/cop/rspec/instance_spy.rb +17 -11
  40. data/lib/rubocop/cop/rspec/instance_variable.rb +3 -7
  41. data/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb +2 -5
  42. data/lib/rubocop/cop/rspec/it_behaves_like.rb +4 -5
  43. data/lib/rubocop/cop/rspec/leading_subject.rb +12 -19
  44. data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +1 -4
  45. data/lib/rubocop/cop/rspec/let_before_examples.rb +9 -25
  46. data/lib/rubocop/cop/rspec/let_setup.rb +15 -3
  47. data/lib/rubocop/cop/rspec/message_chain.rb +6 -5
  48. data/lib/rubocop/cop/rspec/message_expectation.rb +1 -1
  49. data/lib/rubocop/cop/rspec/message_spies.rb +1 -2
  50. data/lib/rubocop/cop/rspec/multiple_subjects.rb +17 -18
  51. data/lib/rubocop/cop/rspec/named_subject.rb +7 -7
  52. data/lib/rubocop/cop/rspec/nested_groups.rb +9 -10
  53. data/lib/rubocop/cop/rspec/not_to_not.rb +4 -5
  54. data/lib/rubocop/cop/rspec/predicate_matcher.rb +25 -55
  55. data/lib/rubocop/cop/rspec/rails/http_status.rb +6 -8
  56. data/lib/rubocop/cop/rspec/receive_counts.rb +14 -16
  57. data/lib/rubocop/cop/rspec/receive_never.rb +10 -10
  58. data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +11 -1
  59. data/lib/rubocop/cop/rspec/return_from_stub.rb +11 -21
  60. data/lib/rubocop/cop/rspec/scattered_let.rb +11 -1
  61. data/lib/rubocop/cop/rspec/shared_context.rb +7 -20
  62. data/lib/rubocop/cop/rspec/shared_examples.rb +6 -8
  63. data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +14 -17
  64. data/lib/rubocop/cop/rspec/subject_stub.rb +23 -51
  65. data/lib/rubocop/cop/rspec/variable_definition.rb +56 -0
  66. data/lib/rubocop/cop/rspec/variable_name.rb +47 -0
  67. data/lib/rubocop/cop/rspec/yield.rb +13 -10
  68. data/lib/rubocop/cop/rspec_cops.rb +5 -1
  69. data/lib/rubocop/rspec/blank_line_separation.rb +0 -8
  70. data/lib/rubocop/rspec/corrector/move_node.rb +52 -0
  71. data/lib/rubocop/rspec/description_extractor.rb +2 -6
  72. data/lib/rubocop/rspec/example.rb +1 -1
  73. data/lib/rubocop/rspec/example_group.rb +21 -49
  74. data/lib/rubocop/rspec/factory_bot.rb +7 -1
  75. data/lib/rubocop/rspec/language.rb +8 -0
  76. data/lib/rubocop/rspec/language/node_pattern.rb +5 -1
  77. data/lib/rubocop/rspec/top_level_group.rb +44 -0
  78. data/lib/rubocop/rspec/variable.rb +16 -0
  79. data/lib/rubocop/rspec/version.rb +1 -1
  80. metadata +17 -10
  81. 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 #{RSPEC} #{(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.0'
7
+ STRING = '1.42.0'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.38.0
4
+ version: 1.42.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-11 00:00:00.000000000 Z
13
+ date: 2020-07-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: 0.68.1
21
+ version: 0.87.0
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.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rack
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -110,6 +110,7 @@ extra_rdoc_files:
110
110
  - README.md
111
111
  files:
112
112
  - CHANGELOG.md
113
+ - CODE_OF_CONDUCT.md
113
114
  - MIT-LICENSE.md
114
115
  - README.md
115
116
  - config/default.yml
@@ -123,6 +124,7 @@ files:
123
124
  - lib/rubocop/cop/rspec/before_after_all.rb
124
125
  - lib/rubocop/cop/rspec/capybara/current_path_expectation.rb
125
126
  - lib/rubocop/cop/rspec/capybara/feature_methods.rb
127
+ - lib/rubocop/cop/rspec/capybara/visibility_matcher.rb
126
128
  - lib/rubocop/cop/rspec/context_method.rb
127
129
  - lib/rubocop/cop/rspec/context_wording.rb
128
130
  - lib/rubocop/cop/rspec/cop.rb
@@ -133,6 +135,7 @@ files:
133
135
  - lib/rubocop/cop/rspec/described_class_module_wrapping.rb
134
136
  - lib/rubocop/cop/rspec/dialect.rb
135
137
  - lib/rubocop/cop/rspec/empty_example_group.rb
138
+ - lib/rubocop/cop/rspec/empty_hook.rb
136
139
  - lib/rubocop/cop/rspec/empty_line_after_example.rb
137
140
  - lib/rubocop/cop/rspec/empty_line_after_example_group.rb
138
141
  - lib/rubocop/cop/rspec/empty_line_after_final_let.rb
@@ -192,6 +195,8 @@ files:
192
195
  - lib/rubocop/cop/rspec/single_argument_message_chain.rb
193
196
  - lib/rubocop/cop/rspec/subject_stub.rb
194
197
  - lib/rubocop/cop/rspec/unspecified_exception.rb
198
+ - lib/rubocop/cop/rspec/variable_definition.rb
199
+ - lib/rubocop/cop/rspec/variable_name.rb
195
200
  - lib/rubocop/cop/rspec/verified_doubles.rb
196
201
  - lib/rubocop/cop/rspec/void_expect.rb
197
202
  - lib/rubocop/cop/rspec/yield.rb
@@ -201,6 +206,7 @@ files:
201
206
  - lib/rubocop/rspec/blank_line_separation.rb
202
207
  - lib/rubocop/rspec/concept.rb
203
208
  - lib/rubocop/rspec/config_formatter.rb
209
+ - lib/rubocop/rspec/corrector/move_node.rb
204
210
  - lib/rubocop/rspec/description_extractor.rb
205
211
  - lib/rubocop/rspec/example.rb
206
212
  - lib/rubocop/rspec/example_group.rb
@@ -212,7 +218,8 @@ files:
212
218
  - lib/rubocop/rspec/language/node_pattern.rb
213
219
  - lib/rubocop/rspec/node.rb
214
220
  - lib/rubocop/rspec/top_level_describe.rb
215
- - lib/rubocop/rspec/util.rb
221
+ - lib/rubocop/rspec/top_level_group.rb
222
+ - lib/rubocop/rspec/variable.rb
216
223
  - lib/rubocop/rspec/version.rb
217
224
  - lib/rubocop/rspec/wording.rb
218
225
  homepage: https://github.com/rubocop-hq/rubocop-rspec
@@ -221,7 +228,7 @@ licenses:
221
228
  metadata:
222
229
  changelog_uri: https://github.com/rubocop-hq/rubocop-rspec/blob/master/CHANGELOG.md
223
230
  documentation_uri: https://rubocop-rspec.readthedocs.io/
224
- post_install_message:
231
+ post_install_message:
225
232
  rdoc_options: []
226
233
  require_paths:
227
234
  - lib
@@ -229,15 +236,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
236
  requirements:
230
237
  - - ">="
231
238
  - !ruby/object:Gem::Version
232
- version: 2.3.0
239
+ version: 2.4.0
233
240
  required_rubygems_version: !ruby/object:Gem::Requirement
234
241
  requirements:
235
242
  - - ">="
236
243
  - !ruby/object:Gem::Version
237
244
  version: '0'
238
245
  requirements: []
239
- rubygems_version: 3.1.1
240
- signing_key:
246
+ rubygems_version: 3.0.3
247
+ signing_key:
241
248
  specification_version: 4
242
249
  summary: Code style checking for RSpec files
243
250
  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