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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +44 -0
- data/CODE_OF_CONDUCT.md +17 -0
- data/README.md +1 -61
- data/config/default.yml +147 -17
- data/lib/rubocop-rspec.rb +3 -1
- data/lib/rubocop/cop/rspec/align_left_let_brace.rb +11 -18
- data/lib/rubocop/cop/rspec/align_right_let_brace.rb +11 -18
- data/lib/rubocop/cop/rspec/be.rb +1 -1
- data/lib/rubocop/cop/rspec/be_eql.rb +5 -5
- data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +18 -16
- data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +8 -9
- data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +69 -0
- data/lib/rubocop/cop/rspec/context_method.rb +5 -7
- data/lib/rubocop/cop/rspec/cop.rb +9 -29
- data/lib/rubocop/cop/rspec/describe_class.rb +20 -5
- data/lib/rubocop/cop/rspec/describe_method.rb +0 -1
- data/lib/rubocop/cop/rspec/described_class.rb +10 -7
- data/lib/rubocop/cop/rspec/dialect.rb +4 -11
- data/lib/rubocop/cop/rspec/empty_hook.rb +46 -0
- data/lib/rubocop/cop/rspec/empty_line_after_example.rb +5 -3
- data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +5 -5
- data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +4 -1
- data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +5 -5
- data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +4 -1
- data/lib/rubocop/cop/rspec/example_wording.rb +6 -7
- data/lib/rubocop/cop/rspec/expect_actual.rb +7 -10
- data/lib/rubocop/cop/rspec/expect_change.rb +9 -34
- data/lib/rubocop/cop/rspec/expect_in_hook.rb +2 -2
- data/lib/rubocop/cop/rspec/expect_output.rb +1 -1
- data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +23 -20
- data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +10 -16
- data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +6 -7
- data/lib/rubocop/cop/rspec/file_path.rb +32 -4
- data/lib/rubocop/cop/rspec/hook_argument.rb +11 -17
- data/lib/rubocop/cop/rspec/hooks_before_examples.rb +9 -28
- data/lib/rubocop/cop/rspec/implicit_expect.rb +6 -14
- data/lib/rubocop/cop/rspec/implicit_subject.rb +8 -5
- data/lib/rubocop/cop/rspec/instance_spy.rb +17 -11
- data/lib/rubocop/cop/rspec/instance_variable.rb +3 -7
- data/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb +2 -5
- data/lib/rubocop/cop/rspec/it_behaves_like.rb +4 -5
- data/lib/rubocop/cop/rspec/leading_subject.rb +12 -19
- data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +1 -4
- data/lib/rubocop/cop/rspec/let_before_examples.rb +9 -25
- data/lib/rubocop/cop/rspec/let_setup.rb +15 -3
- data/lib/rubocop/cop/rspec/message_chain.rb +6 -5
- data/lib/rubocop/cop/rspec/message_expectation.rb +1 -1
- data/lib/rubocop/cop/rspec/message_spies.rb +1 -2
- data/lib/rubocop/cop/rspec/multiple_subjects.rb +17 -18
- data/lib/rubocop/cop/rspec/named_subject.rb +7 -7
- data/lib/rubocop/cop/rspec/nested_groups.rb +9 -10
- data/lib/rubocop/cop/rspec/not_to_not.rb +4 -5
- data/lib/rubocop/cop/rspec/predicate_matcher.rb +25 -55
- data/lib/rubocop/cop/rspec/rails/http_status.rb +6 -8
- data/lib/rubocop/cop/rspec/receive_counts.rb +14 -16
- data/lib/rubocop/cop/rspec/receive_never.rb +10 -10
- data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +11 -1
- data/lib/rubocop/cop/rspec/return_from_stub.rb +11 -21
- data/lib/rubocop/cop/rspec/scattered_let.rb +11 -1
- data/lib/rubocop/cop/rspec/shared_context.rb +7 -20
- data/lib/rubocop/cop/rspec/shared_examples.rb +6 -8
- data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +14 -17
- data/lib/rubocop/cop/rspec/subject_stub.rb +23 -51
- data/lib/rubocop/cop/rspec/variable_definition.rb +56 -0
- data/lib/rubocop/cop/rspec/variable_name.rb +47 -0
- data/lib/rubocop/cop/rspec/yield.rb +13 -10
- data/lib/rubocop/cop/rspec_cops.rb +5 -1
- data/lib/rubocop/rspec/blank_line_separation.rb +0 -8
- data/lib/rubocop/rspec/corrector/move_node.rb +52 -0
- data/lib/rubocop/rspec/description_extractor.rb +2 -6
- data/lib/rubocop/rspec/example.rb +1 -1
- data/lib/rubocop/rspec/example_group.rb +21 -49
- data/lib/rubocop/rspec/factory_bot.rb +7 -1
- data/lib/rubocop/rspec/language.rb +8 -0
- data/lib/rubocop/rspec/language/node_pattern.rb +5 -1
- data/lib/rubocop/rspec/top_level_group.rb +44 -0
- data/lib/rubocop/rspec/variable.rb +16 -0
- data/lib/rubocop/rspec/version.rb +1 -1
- metadata +17 -10
- 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
|
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.
|
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-
|
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.
|
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.
|
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/
|
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.
|
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.
|
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: []
|
data/lib/rubocop/rspec/util.rb
DELETED
@@ -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
|