rubocop-rspec 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +2 -2
- data/config/default.yml +2 -0
- data/lib/rubocop/cop/rspec/around_block.rb +2 -0
- data/lib/rubocop/cop/rspec/be.rb +1 -0
- data/lib/rubocop/cop/rspec/be_eql.rb +1 -0
- data/lib/rubocop/cop/rspec/before_after_all.rb +1 -0
- data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +3 -0
- data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +3 -0
- data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +2 -0
- data/lib/rubocop/cop/rspec/context_method.rb +1 -0
- data/lib/rubocop/cop/rspec/context_wording.rb +7 -1
- data/lib/rubocop/cop/rspec/describe_class.rb +3 -0
- data/lib/rubocop/cop/rspec/describe_method.rb +1 -0
- data/lib/rubocop/cop/rspec/describe_symbol.rb +1 -0
- data/lib/rubocop/cop/rspec/described_class.rb +5 -0
- data/lib/rubocop/cop/rspec/described_class_module_wrapping.rb +2 -1
- data/lib/rubocop/cop/rspec/dialect.rb +1 -0
- data/lib/rubocop/cop/rspec/empty_hook.rb +1 -0
- data/lib/rubocop/cop/rspec/example_length.rb +26 -12
- data/lib/rubocop/cop/rspec/example_without_description.rb +1 -0
- data/lib/rubocop/cop/rspec/example_wording.rb +1 -0
- data/lib/rubocop/cop/rspec/expect_actual.rb +1 -0
- data/lib/rubocop/cop/rspec/expect_change.rb +2 -0
- data/lib/rubocop/cop/rspec/expect_in_hook.rb +1 -0
- data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +3 -0
- data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +3 -0
- data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +1 -0
- data/lib/rubocop/cop/rspec/file_path.rb +2 -0
- data/lib/rubocop/cop/rspec/focus.rb +3 -0
- data/lib/rubocop/cop/rspec/hook_argument.rb +2 -0
- data/lib/rubocop/cop/rspec/hooks_before_examples.rb +1 -0
- data/lib/rubocop/cop/rspec/implicit_block_expectation.rb +3 -0
- data/lib/rubocop/cop/rspec/implicit_expect.rb +1 -0
- data/lib/rubocop/cop/rspec/implicit_subject.rb +1 -0
- data/lib/rubocop/cop/rspec/instance_spy.rb +2 -0
- data/lib/rubocop/cop/rspec/instance_variable.rb +4 -0
- data/lib/rubocop/cop/rspec/it_behaves_like.rb +1 -0
- data/lib/rubocop/cop/rspec/iterated_expectation.rb +2 -0
- data/lib/rubocop/cop/rspec/let_before_examples.rb +1 -0
- data/lib/rubocop/cop/rspec/let_setup.rb +3 -0
- data/lib/rubocop/cop/rspec/message_expectation.rb +2 -0
- data/lib/rubocop/cop/rspec/message_spies.rb +2 -0
- data/lib/rubocop/cop/rspec/mixin/variable.rb +1 -0
- data/lib/rubocop/cop/rspec/multiple_expectations.rb +3 -0
- data/lib/rubocop/cop/rspec/named_subject.rb +3 -0
- data/lib/rubocop/cop/rspec/not_to_not.rb +1 -0
- data/lib/rubocop/cop/rspec/overwriting_setup.rb +2 -0
- data/lib/rubocop/cop/rspec/pending.rb +4 -0
- data/lib/rubocop/cop/rspec/predicate_matcher.rb +5 -0
- data/lib/rubocop/cop/rspec/rails/http_status.rb +1 -0
- data/lib/rubocop/cop/rspec/receive_counts.rb +2 -0
- data/lib/rubocop/cop/rspec/receive_never.rb +1 -0
- data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +8 -1
- data/lib/rubocop/cop/rspec/repeated_example_group_description.rb +4 -0
- data/lib/rubocop/cop/rspec/repeated_include_example.rb +3 -0
- data/lib/rubocop/cop/rspec/return_from_stub.rb +5 -0
- data/lib/rubocop/cop/rspec/shared_context.rb +4 -0
- data/lib/rubocop/cop/rspec/shared_examples.rb +1 -0
- data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +2 -0
- data/lib/rubocop/cop/rspec/stubbed_mock.rb +1 -0
- data/lib/rubocop/cop/rspec/subject_stub.rb +1 -0
- data/lib/rubocop/cop/rspec/unspecified_exception.rb +1 -0
- data/lib/rubocop/cop/rspec/verified_doubles.rb +1 -0
- data/lib/rubocop/cop/rspec/void_expect.rb +2 -0
- data/lib/rubocop/cop/rspec/yield.rb +3 -0
- data/lib/rubocop/rspec/example.rb +5 -0
- data/lib/rubocop/rspec/hook.rb +1 -0
- data/lib/rubocop/rspec/language.rb +10 -0
- data/lib/rubocop/rspec/version.rb +1 -1
- metadata +6 -6
@@ -50,13 +50,16 @@ module RuboCop
|
|
50
50
|
MSG = 'Repeated include of shared_examples %<name>s ' \
|
51
51
|
'on line(s) %<repeat>s'
|
52
52
|
|
53
|
+
# @!method several_include_examples?(node)
|
53
54
|
def_node_matcher :several_include_examples?, <<-PATTERN
|
54
55
|
(begin <#include_examples? #include_examples? ...>)
|
55
56
|
PATTERN
|
56
57
|
|
58
|
+
# @!method include_examples?(node)
|
57
59
|
def_node_matcher :include_examples?,
|
58
60
|
send_pattern('#Includes.examples')
|
59
61
|
|
62
|
+
# @!method shared_examples_name(node)
|
60
63
|
def_node_matcher :shared_examples_name, <<-PATTERN
|
61
64
|
(send _ #Includes.examples $_ ...)
|
62
65
|
PATTERN
|
@@ -41,8 +41,13 @@ module RuboCop
|
|
41
41
|
MSG_BLOCK = 'Use block for static values.'
|
42
42
|
RESTRICT_ON_SEND = %i[and_return].freeze
|
43
43
|
|
44
|
+
# @!method contains_stub?(node)
|
44
45
|
def_node_search :contains_stub?, '(send nil? :receive (...))'
|
46
|
+
|
47
|
+
# @!method stub_with_block?(node)
|
45
48
|
def_node_matcher :stub_with_block?, '(block #contains_stub? ...)'
|
49
|
+
|
50
|
+
# @!method and_return_value(node)
|
46
51
|
def_node_search :and_return_value, <<-PATTERN
|
47
52
|
$(send _ :and_return $(...))
|
48
53
|
PATTERN
|
@@ -56,9 +56,11 @@ module RuboCop
|
|
56
56
|
MSG_EXAMPLES = "Use `shared_examples` when you don't define context."
|
57
57
|
MSG_CONTEXT = "Use `shared_context` when you don't define examples."
|
58
58
|
|
59
|
+
# @!method examples?(node)
|
59
60
|
def_node_search :examples?,
|
60
61
|
send_pattern('{#Includes.examples #Examples.all}')
|
61
62
|
|
63
|
+
# @!method context?(node)
|
62
64
|
def_node_search :context?, <<-PATTERN
|
63
65
|
(
|
64
66
|
send #rspec? {
|
@@ -70,8 +72,10 @@ module RuboCop
|
|
70
72
|
)
|
71
73
|
PATTERN
|
72
74
|
|
75
|
+
# @!method shared_context(node)
|
73
76
|
def_node_matcher :shared_context,
|
74
77
|
block_pattern('#SharedGroups.context')
|
78
|
+
# @!method shared_example(node)
|
75
79
|
def_node_matcher :shared_example,
|
76
80
|
block_pattern('#SharedGroups.examples')
|
77
81
|
|
@@ -23,10 +23,12 @@ module RuboCop
|
|
23
23
|
'`%<called>s` with a single argument.'
|
24
24
|
RESTRICT_ON_SEND = %i[receive_message_chain stub_chain].freeze
|
25
25
|
|
26
|
+
# @!method message_chain(node)
|
26
27
|
def_node_matcher :message_chain, <<-PATTERN
|
27
28
|
(send _ {:receive_message_chain :stub_chain} $_)
|
28
29
|
PATTERN
|
29
30
|
|
31
|
+
# @!method single_key_hash?(node)
|
30
32
|
def_node_matcher :single_key_hash?, '(hash pair)'
|
31
33
|
|
32
34
|
def on_send(node)
|
@@ -16,10 +16,12 @@ module RuboCop
|
|
16
16
|
'Chain the methods or remove it.'
|
17
17
|
RESTRICT_ON_SEND = %i[expect].freeze
|
18
18
|
|
19
|
+
# @!method expect?(node)
|
19
20
|
def_node_matcher :expect?, <<-PATTERN
|
20
21
|
(send nil? :expect ...)
|
21
22
|
PATTERN
|
22
23
|
|
24
|
+
# @!method expect_block?(node)
|
23
25
|
def_node_matcher :expect_block?, <<-PATTERN
|
24
26
|
(block #expect? (args) _body)
|
25
27
|
PATTERN
|
@@ -17,10 +17,13 @@ module RuboCop
|
|
17
17
|
|
18
18
|
MSG = 'Use `.and_yield`.'
|
19
19
|
|
20
|
+
# @!method method_on_stub?(node)
|
20
21
|
def_node_search :method_on_stub?, '(send nil? :receive ...)'
|
21
22
|
|
23
|
+
# @!method block_arg(node)
|
22
24
|
def_node_matcher :block_arg, '(args (blockarg $_))'
|
23
25
|
|
26
|
+
# @!method block_call?(node)
|
24
27
|
def_node_matcher :block_call?, '(send (lvar %) :call ...)'
|
25
28
|
|
26
29
|
def on_block(node)
|
@@ -4,8 +4,13 @@ module RuboCop
|
|
4
4
|
module RSpec
|
5
5
|
# Wrapper for RSpec examples
|
6
6
|
class Example < Concept
|
7
|
+
# @!method extract_doc_string(node)
|
7
8
|
def_node_matcher :extract_doc_string, '(send _ _ $_ ...)'
|
9
|
+
|
10
|
+
# @!method extract_metadata(node)
|
8
11
|
def_node_matcher :extract_metadata, '(send _ _ _ $...)'
|
12
|
+
|
13
|
+
# @!method extract_implementation(node)
|
9
14
|
def_node_matcher :extract_implementation, '(block send args $_)'
|
10
15
|
|
11
16
|
def doc_string
|
data/lib/rubocop/rspec/hook.rb
CHANGED
@@ -19,23 +19,31 @@ module RuboCop
|
|
19
19
|
attr_accessor :config
|
20
20
|
end
|
21
21
|
|
22
|
+
# @!method rspec?(node)
|
22
23
|
def_node_matcher :rspec?, '{(const {nil? cbase} :RSpec) nil?}'
|
23
24
|
|
25
|
+
# @!method example_group?(node)
|
24
26
|
def_node_matcher :example_group?, block_pattern('#ExampleGroups.all')
|
25
27
|
|
28
|
+
# @!method shared_group?(node)
|
26
29
|
def_node_matcher :shared_group?, block_pattern('#SharedGroups.all')
|
27
30
|
|
31
|
+
# @!method spec_group?(node)
|
28
32
|
def_node_matcher :spec_group?,
|
29
33
|
block_pattern('{#SharedGroups.all #ExampleGroups.all}')
|
30
34
|
|
35
|
+
# @!method example_group_with_body?(node)
|
31
36
|
def_node_matcher :example_group_with_body?, <<-PATTERN
|
32
37
|
(block #{send_pattern('#ExampleGroups.all')} args !nil?)
|
33
38
|
PATTERN
|
34
39
|
|
40
|
+
# @!method example?(node)
|
35
41
|
def_node_matcher :example?, block_pattern('#Examples.all')
|
36
42
|
|
43
|
+
# @!method hook?(node)
|
37
44
|
def_node_matcher :hook?, block_pattern('#Hooks.all')
|
38
45
|
|
46
|
+
# @!method let?(node)
|
39
47
|
def_node_matcher :let?, <<-PATTERN
|
40
48
|
{
|
41
49
|
#{block_pattern('#Helpers.all')}
|
@@ -43,6 +51,7 @@ module RuboCop
|
|
43
51
|
}
|
44
52
|
PATTERN
|
45
53
|
|
54
|
+
# @!method include?(node)
|
46
55
|
def_node_matcher :include?, <<-PATTERN
|
47
56
|
{
|
48
57
|
#{send_pattern('#Includes.all')}
|
@@ -50,6 +59,7 @@ module RuboCop
|
|
50
59
|
}
|
51
60
|
PATTERN
|
52
61
|
|
62
|
+
# @!method subject?(node)
|
53
63
|
def_node_matcher :subject?, block_pattern('#Subjects.all')
|
54
64
|
|
55
65
|
module ExampleGroups # :nodoc:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Backus
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-04-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -251,11 +251,11 @@ files:
|
|
251
251
|
- lib/rubocop/rspec/node.rb
|
252
252
|
- lib/rubocop/rspec/version.rb
|
253
253
|
- lib/rubocop/rspec/wording.rb
|
254
|
-
homepage: https://github.com/rubocop
|
254
|
+
homepage: https://github.com/rubocop/rubocop-rspec
|
255
255
|
licenses:
|
256
256
|
- MIT
|
257
257
|
metadata:
|
258
|
-
changelog_uri: https://github.com/rubocop
|
258
|
+
changelog_uri: https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md
|
259
259
|
documentation_uri: https://docs.rubocop.org/rubocop-rspec/
|
260
260
|
post_install_message:
|
261
261
|
rdoc_options: []
|
@@ -265,14 +265,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
265
265
|
requirements:
|
266
266
|
- - ">="
|
267
267
|
- !ruby/object:Gem::Version
|
268
|
-
version: 2.
|
268
|
+
version: 2.5.0
|
269
269
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
270
270
|
requirements:
|
271
271
|
- - ">="
|
272
272
|
- !ruby/object:Gem::Version
|
273
273
|
version: '0'
|
274
274
|
requirements: []
|
275
|
-
rubygems_version: 3.2.
|
275
|
+
rubygems_version: 3.2.16
|
276
276
|
signing_key:
|
277
277
|
specification_version: 4
|
278
278
|
summary: Code style checking for RSpec files
|