rubocop-rspec 1.38.1 → 1.39.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29dceb0d781f6ba1f1ad5ec94edff9c04c19223eb2d0be2d0e727cefc160e133
4
- data.tar.gz: 2ae835d2db78c365c46ebed92907b375c3d649e4446035351b21b85fad732718
3
+ metadata.gz: 9bb27c4586307d99c6c4575351d9974dc872229cd91b5f5f4deb99530c7e0297
4
+ data.tar.gz: 6efec312480c6800454ceb42eec2905e9d093bcc1f107be2f60c36a0a3ac0f4b
5
5
  SHA512:
6
- metadata.gz: 8ad6ec4d0fd1b3e87d00563de947b31b3b3b22f80e08782c57003dcd9972bb3b802d59498423a30318a4f5905a634566e803521852becc0da43222a6165913b2
7
- data.tar.gz: 7afaeb5b2f202ac0aa6b2480e00cf5bac72812c40aa43c236d3fcf3b0830314249686c9e3b6dcc4495c5e6db47ab142aeeb8a86c0488efb0c8893f2acedcf486
6
+ metadata.gz: 4c0ae32d6609fa83633e18a6fe0172c8d1dc849595180f2a2b2a3c7f673dd50dc6eb695b9c880498be42ca7e9dc468f1f67c43d0677c0ae0e845b8c89630b673
7
+ data.tar.gz: c0e23ebca292ecff3d294d4bbe6b9a020be769cb834115f8e9dbd55d3dbd798fda2ddc548799a869b1620810e355ed7aee8a3210fecb5fa77f844a815361c2b8
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 1.39.0 (2020-05-01)
6
+
7
+ * Fix `RSpec/FilePath` detection when absolute path includes test subject. ([@eitoball][])
8
+ * Add new `Capybara/VisibilityMatcher` cop. ([@aried3r][])
9
+ * Ignore String constants by `RSpec/Describe`. ([@AlexWayfer][])
10
+ * Drop support for ruby 2.3. ([@bquorning][])
11
+ * Fix multiple cops to detect `let` with proc argument. ([@tejasbubane][])
12
+ * Add autocorrect support for `RSpec/ScatteredLet`. ([@Darhazer][])
13
+ * Add new `RSpec/EmptyHook` cop. ([@tejasbubane][])
14
+
5
15
  ## 1.38.1 (2020-02-15)
6
16
 
7
17
  * Fix `RSpec/RepeatedDescription` to detect descriptions with interpolation and methods. ([@lazycoder9][])
@@ -489,3 +499,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
489
499
  [@dduugg]: https://github.com/dduugg
490
500
  [@lazycoder9]: https://github.com/lazycoder9
491
501
  [@elebow]: https://github.com/elebow
502
+ [@eitoball]: https://github.com/eitoball
503
+ [@aried3r]: https://github.com/aried3r
504
+ [@AlexWayfer]: https://github.com/AlexWayfer
505
+ [@tejasbubane]: https://github.com/tejasbubane
data/config/default.yml CHANGED
@@ -105,6 +105,12 @@ RSpec/EmptyExampleGroup:
105
105
  CustomIncludeMethods: []
106
106
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
107
107
 
108
+ RSpec/EmptyHook:
109
+ Description: Checks for empty before and after hooks.
110
+ Enabled: true
111
+ VersionAdded: 1.39.0
112
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
113
+
108
114
  RSpec/EmptyLineAfterExample:
109
115
  Description: Checks if there is an empty line after example blocks.
110
116
  Enabled: true
@@ -324,7 +330,6 @@ RSpec/MultipleExpectations:
324
330
  Description: Checks if examples contain too many `expect` calls.
325
331
  Enabled: true
326
332
  Max: 1
327
- AggregateFailuresByDefault: false
328
333
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
329
334
 
330
335
  RSpec/MultipleSubjects:
@@ -417,6 +422,7 @@ RSpec/ScatteredLet:
417
422
  Description: Checks for let scattered across the example group.
418
423
  Enabled: true
419
424
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
425
+ VersionChanged: '1.39'
420
426
 
421
427
  RSpec/ScatteredSetup:
422
428
  Description: Checks for setup scattered across multiple hooks in an example group.
@@ -476,6 +482,12 @@ Capybara/FeatureMethods:
476
482
  EnabledMethods: []
477
483
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
478
484
 
485
+ Capybara/VisibilityMatcher:
486
+ Description: Checks for boolean visibility in capybara finders.
487
+ Enabled: true
488
+ VersionAdded: '1.39'
489
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher
490
+
479
491
  FactoryBot/AttributeDefinedStatically:
480
492
  Description: Always declare attribute values as blocks.
481
493
  Enabled: true
data/lib/rubocop-rspec.rb CHANGED
@@ -11,7 +11,6 @@ require_relative 'rubocop/rspec/inject'
11
11
  require_relative 'rubocop/rspec/node'
12
12
  require_relative 'rubocop/rspec/top_level_describe'
13
13
  require_relative 'rubocop/rspec/wording'
14
- require_relative 'rubocop/rspec/util'
15
14
  require_relative 'rubocop/rspec/language'
16
15
  require_relative 'rubocop/rspec/language/node_pattern'
17
16
  require_relative 'rubocop/rspec/concept'
@@ -23,6 +22,7 @@ require_relative 'rubocop/rspec/align_let_brace'
23
22
  require_relative 'rubocop/rspec/factory_bot'
24
23
  require_relative 'rubocop/rspec/final_end_location'
25
24
  require_relative 'rubocop/rspec/blank_line_separation'
25
+ require_relative 'rubocop/rspec/corrector/move_node'
26
26
 
27
27
  RuboCop::RSpec::Inject.defaults!
28
28
 
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module RSpec
6
+ module Capybara
7
+ # Checks for boolean visibility in capybara finders.
8
+ #
9
+ # Capybara lets you find elements that match a certain visibility using
10
+ # the `:visible` option. `:visible` accepts both boolean and symbols as
11
+ # values, however using booleans can have unwanted effects. `visible:
12
+ # false` does not find just invisible elements, but both visible and
13
+ # invisible elements. For expressiveness and clarity, use one of the
14
+ # symbol values, `:all`, `:hidden` or `:visible`.
15
+ # (https://www.rubydoc.info/gems/capybara/Capybara%2FNode%2FFinders:all)
16
+ #
17
+ # @example
18
+ #
19
+ # # bad
20
+ # expect(page).to have_selector('.foo', visible: false)
21
+ #
22
+ # # bad
23
+ # expect(page).to have_selector('.foo', visible: true)
24
+ #
25
+ # # good
26
+ # expect(page).to have_selector('.foo', visible: :all)
27
+ #
28
+ # # good
29
+ # expect(page).to have_selector('.foo', visible: :hidden)
30
+ #
31
+ # # good
32
+ # expect(page).to have_selector('.foo', visible: :visible)
33
+ #
34
+ class VisibilityMatcher < Cop
35
+ MSG_FALSE = 'Use `:all` or `:hidden` instead of `false`.'
36
+ MSG_TRUE = 'Use `:visible` instead of `true`.'
37
+
38
+ def_node_matcher :visible_true?, <<~PATTERN
39
+ (send nil? :have_selector ... (hash <$(pair (sym :visible) true) ...>))
40
+ PATTERN
41
+
42
+ def_node_matcher :visible_false?, <<~PATTERN
43
+ (send nil? :have_selector ... (hash <$(pair (sym :visible) false) ...>))
44
+ PATTERN
45
+
46
+ def on_send(node)
47
+ visible_false?(node) { |arg| add_offense(arg, message: MSG_FALSE) }
48
+ visible_true?(node) { |arg| add_offense(arg, message: MSG_TRUE) }
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RuboCop
4
- module Cop # rubocop:disable Style/Documentation
4
+ module Cop
5
5
  WorkaroundCop = Cop.dup
6
6
 
7
7
  # Clone of the the normal RuboCop::Cop::Cop class so we can rewrite
@@ -12,6 +12,11 @@ module RuboCop
12
12
  #
13
13
  # # good
14
14
  # describe TestedClass do
15
+ # subject { described_class }
16
+ # end
17
+ #
18
+ # describe 'TestedClass::VERSION' do
19
+ # subject { Object.const_get(self.class.description) }
15
20
  # end
16
21
  #
17
22
  # describe "A feature example", type: :feature do
@@ -44,12 +49,20 @@ module RuboCop
44
49
 
45
50
  def_node_matcher :shared_group?, SharedGroups::ALL.block_pattern
46
51
 
47
- def on_top_level_describe(node, args)
52
+ def on_top_level_describe(node, (described_value, _))
48
53
  return if shared_group?(root_node)
49
54
  return if valid_describe?(node)
50
55
  return if describe_with_rails_metadata?(node)
56
+ return if string_constant_describe?(described_value)
57
+
58
+ add_offense(described_value)
59
+ end
60
+
61
+ private
51
62
 
52
- add_offense(args.first)
63
+ def string_constant_describe?(described_value)
64
+ described_value.str_type? &&
65
+ described_value.value =~ /^((::)?[A-Z]\w*)+$/
53
66
  end
54
67
  end
55
68
  end
@@ -18,7 +18,6 @@ module RuboCop
18
18
  # end
19
19
  class DescribeMethod < Cop
20
20
  include RuboCop::RSpec::TopLevelDescribe
21
- include RuboCop::RSpec::Util
22
21
 
23
22
  MSG = 'The second argument to describe should be the method '\
24
23
  "being tested. '#instance' or '.class'."
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module RSpec
6
+ # Checks for empty before and after hooks.
7
+ #
8
+ # @example
9
+ # # bad
10
+ # before {}
11
+ # after do; end
12
+ # before(:all) do
13
+ # end
14
+ # after(:all) { }
15
+ #
16
+ # # good
17
+ # before { create_users }
18
+ # after do
19
+ # cleanup_users
20
+ # end
21
+ # before(:all) do
22
+ # create_feed
23
+ # end
24
+ # after(:all) { cleanup_feed }
25
+ class EmptyHook < Cop
26
+ include RuboCop::Cop::RangeHelp
27
+
28
+ MSG = 'Empty hook detected.'
29
+
30
+ def_node_matcher :empty_hook?, <<~PATTERN
31
+ (block $#{Hooks::ALL.send_pattern} _ nil?)
32
+ PATTERN
33
+
34
+ def on_block(node)
35
+ empty_hook?(node) do |hook|
36
+ add_offense(hook)
37
+ end
38
+ end
39
+
40
+ def autocorrect(node)
41
+ lambda do |corrector|
42
+ block = node.parent
43
+ range = range_with_surrounding_space(range: block.loc.expression)
44
+ corrector.remove(range)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -103,7 +103,9 @@ module RuboCop
103
103
  end
104
104
 
105
105
  def filename_ends_with?(glob)
106
- File.fnmatch?("*#{glob}", processed_source.buffer.name)
106
+ filename =
107
+ RuboCop::PathUtil.relative_path(processed_source.buffer.name)
108
+ File.fnmatch?("*#{glob}", filename)
107
109
  end
108
110
 
109
111
  def relevant_rubocop_rspec_file?(_file)
@@ -24,9 +24,6 @@ module RuboCop
24
24
  # end
25
25
  #
26
26
  class HooksBeforeExamples < Cop
27
- include RangeHelp
28
- include RuboCop::RSpec::FinalEndLocation
29
-
30
27
  MSG = 'Move `%<hook>s` above the examples in the group.'
31
28
 
32
29
  def_node_matcher :example_or_group?, <<-PATTERN
@@ -45,11 +42,9 @@ module RuboCop
45
42
  def autocorrect(node)
46
43
  lambda do |corrector|
47
44
  first_example = find_first_example(node.parent)
48
- first_example_pos = first_example.loc.expression
49
- indent = "\n" + ' ' * first_example.loc.column
50
-
51
- corrector.insert_before(first_example_pos, source(node) + indent)
52
- corrector.remove(node_range_with_surrounding_space(node))
45
+ RuboCop::RSpec::Corrector::MoveNode.new(
46
+ node, corrector, processed_source
47
+ ).move_before(first_example)
53
48
  end
54
49
  end
55
50
 
@@ -77,19 +72,6 @@ module RuboCop
77
72
  def find_first_example(node)
78
73
  node.children.find { |sibling| example_or_group?(sibling) }
79
74
  end
80
-
81
- def node_range_with_surrounding_space(node)
82
- range = node_range(node)
83
- range_by_whole_lines(range, include_final_newline: true)
84
- end
85
-
86
- def source(node)
87
- node_range(node).source
88
- end
89
-
90
- def node_range(node)
91
- node.loc.expression.with(end_pos: final_end_location(node).end_pos)
92
- end
93
75
  end
94
76
  end
95
77
  end
@@ -32,8 +32,6 @@ module RuboCop
32
32
  # it { expect_something_else }
33
33
  #
34
34
  class LeadingSubject < Cop
35
- include RangeHelp
36
-
37
35
  MSG = 'Declare `subject` above any other `%<offending>s` declarations.'
38
36
 
39
37
  def on_block(node)
@@ -58,10 +56,9 @@ module RuboCop
58
56
  def autocorrect(node)
59
57
  lambda do |corrector|
60
58
  first_node = find_first_offending_node(node)
61
- first_node_position = first_node.loc.expression
62
- indent = "\n" + ' ' * first_node.loc.column
63
- corrector.insert_before(first_node_position, node.source + indent)
64
- corrector.remove(node_range(node))
59
+ RuboCop::RSpec::Corrector::MoveNode.new(
60
+ node, corrector, processed_source
61
+ ).move_before(first_node)
65
62
  end
66
63
  end
67
64
 
@@ -75,10 +72,6 @@ module RuboCop
75
72
  node.parent.children.find { |sibling| offending?(sibling) }
76
73
  end
77
74
 
78
- def node_range(node)
79
- range_by_whole_lines(node.source_range, include_final_newline: true)
80
- end
81
-
82
75
  def in_spec_block?(node)
83
76
  node.each_ancestor(:block).any? do |ancestor|
84
77
  example?(ancestor)
@@ -31,9 +31,6 @@ module RuboCop
31
31
  # expect(some).to be
32
32
  # end
33
33
  class LetBeforeExamples < Cop
34
- include RangeHelp
35
- include RuboCop::RSpec::FinalEndLocation
36
-
37
34
  MSG = 'Move `let` before the examples in the group.'
38
35
 
39
36
  def_node_matcher :example_or_group?, <<-PATTERN
@@ -52,11 +49,9 @@ module RuboCop
52
49
  def autocorrect(node)
53
50
  lambda do |corrector|
54
51
  first_example = find_first_example(node.parent)
55
- first_example_pos = first_example.loc.expression
56
- indent = "\n" + ' ' * first_example.loc.column
57
-
58
- corrector.insert_before(first_example_pos, source(node) + indent)
59
- corrector.remove(node_range_with_surrounding_space(node))
52
+ RuboCop::RSpec::Corrector::MoveNode.new(
53
+ node, corrector, processed_source
54
+ ).move_before(first_example)
60
55
  end
61
56
  end
62
57
 
@@ -80,19 +75,6 @@ module RuboCop
80
75
  def find_first_example(node)
81
76
  node.children.find { |sibling| example_or_group?(sibling) }
82
77
  end
83
-
84
- def node_range_with_surrounding_space(node)
85
- range = node_range(node)
86
- range_by_whole_lines(range, include_final_newline: true)
87
- end
88
-
89
- def source(node)
90
- node_range(node).source
91
- end
92
-
93
- def node_range(node)
94
- node.loc.expression.with(end_pos: final_end_location(node).end_pos)
95
- end
96
78
  end
97
79
  end
98
80
  end
@@ -6,11 +6,11 @@ module RuboCop
6
6
  # Checks for explicitly referenced test subjects.
7
7
  #
8
8
  # RSpec lets you declare an "implicit subject" using `subject { ... }`
9
- # which allows for tests like `it { should be_valid }`. If you need to
10
- # reference your test subject you should explicitly name it using
11
- # `subject(:your_subject_name) { ... }`. Your test subjects should be
12
- # the most important object in your tests so they deserve a descriptive
13
- # name.
9
+ # which allows for tests like `it { is_expected.to be_valid }`.
10
+ # If you need to reference your test subject you should explicitly
11
+ # name it using `subject(:your_subject_name) { ... }`. Your test subjects
12
+ # should be the most important object in your tests so they deserve
13
+ # a descriptive name.
14
14
  #
15
15
  # This cop can be configured in your configuration using the
16
16
  # `IgnoreSharedExamples` which will not report offenses for implicit
@@ -39,7 +39,7 @@ module RuboCop
39
39
  # RSpec.describe Foo do
40
40
  # subject(:user) { described_class.new }
41
41
  #
42
- # it { should be_valid }
42
+ # it { is_expected.to be_valid }
43
43
  # end
44
44
  class NamedSubject < Cop
45
45
  MSG = 'Name your test subject if you need '\
@@ -35,6 +35,15 @@ module RuboCop
35
35
  check_let_declarations(node.body)
36
36
  end
37
37
 
38
+ def autocorrect(node)
39
+ lambda do |corrector|
40
+ first_let = find_first_let(node.parent)
41
+ RuboCop::RSpec::Corrector::MoveNode.new(
42
+ node, corrector, processed_source
43
+ ).move_after(first_let)
44
+ end
45
+ end
46
+
38
47
  private
39
48
 
40
49
  def check_let_declarations(body)
@@ -47,6 +56,10 @@ module RuboCop
47
56
  add_offense(node)
48
57
  end
49
58
  end
59
+
60
+ def find_first_let(node)
61
+ node.children.find { |child| let?(child) }
62
+ end
50
63
  end
51
64
  end
52
65
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative 'rspec/capybara/current_path_expectation'
4
4
  require_relative 'rspec/capybara/feature_methods'
5
+ require_relative 'rspec/capybara/visibility_matcher'
5
6
 
6
7
  require_relative 'rspec/factory_bot/attribute_defined_statically'
7
8
  require_relative 'rspec/factory_bot/create_list'
@@ -9,7 +10,7 @@ require_relative 'rspec/factory_bot/factory_class_name'
9
10
 
10
11
  begin
11
12
  require_relative 'rspec/rails/http_status'
12
- rescue LoadError # rubocop:disable Lint/SuppressedException
13
+ rescue LoadError
13
14
  # Rails/HttpStatus cannot be loaded if rack/utils is unavailable.
14
15
  end
15
16
 
@@ -29,6 +30,7 @@ require_relative 'rspec/described_class'
29
30
  require_relative 'rspec/described_class_module_wrapping'
30
31
  require_relative 'rspec/dialect'
31
32
  require_relative 'rspec/empty_example_group'
33
+ require_relative 'rspec/empty_hook'
32
34
  require_relative 'rspec/empty_line_after_example'
33
35
  require_relative 'rspec/empty_line_after_example_group'
34
36
  require_relative 'rspec/empty_line_after_final_let'
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module RSpec
5
+ module Corrector
6
+ # Helper methods to move a node
7
+ class MoveNode
8
+ include RuboCop::Cop::RangeHelp
9
+ include RuboCop::RSpec::FinalEndLocation
10
+
11
+ attr_reader :original, :corrector, :processed_source
12
+
13
+ def initialize(node, corrector, processed_source)
14
+ @original = node
15
+ @corrector = corrector
16
+ @processed_source = processed_source # used by RangeHelp
17
+ end
18
+
19
+ def move_before(other) # rubocop:disable Metrics/AbcSize
20
+ position = other.loc.expression
21
+ indent = "\n" + ' ' * other.loc.column
22
+
23
+ corrector.insert_before(position, source(original) + indent)
24
+ corrector.remove(node_range_with_surrounding_space(original))
25
+ end
26
+
27
+ def move_after(other)
28
+ position = final_end_location(other)
29
+ indent = "\n" + ' ' * other.loc.column
30
+
31
+ corrector.insert_after(position, indent + source(original))
32
+ corrector.remove(node_range_with_surrounding_space(original))
33
+ end
34
+
35
+ private
36
+
37
+ def source(node)
38
+ node_range(node).source
39
+ end
40
+
41
+ def node_range(node)
42
+ node.loc.expression.with(end_pos: final_end_location(node).end_pos)
43
+ end
44
+
45
+ def node_range_with_surrounding_space(node)
46
+ range = node_range(node)
47
+ range_by_whole_lines(range, include_final_newline: true)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -28,6 +28,14 @@ module RuboCop
28
28
  "(block #{send_pattern} ...)"
29
29
  end
30
30
 
31
+ def block_pass_pattern
32
+ "(send #{RSPEC} #{node_pattern_union} _ block_pass)"
33
+ end
34
+
35
+ def block_or_block_pass_pattern
36
+ "{#{block_pattern} #{block_pass_pattern}}"
37
+ end
38
+
31
39
  def send_pattern
32
40
  "(send #{RSPEC} #{node_pattern_union} ...)"
33
41
  end
@@ -17,7 +17,7 @@ module RuboCop
17
17
 
18
18
  def_node_matcher :hook?, Hooks::ALL.block_pattern
19
19
 
20
- def_node_matcher :let?, Helpers::ALL.block_pattern
20
+ def_node_matcher :let?, Helpers::ALL.block_or_block_pass_pattern
21
21
 
22
22
  def_node_matcher :subject?, Subject::ALL.block_pattern
23
23
  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.39.0'
8
8
  end
9
9
  end
10
10
  end
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: 1.38.1
4
+ version: 1.39.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: 2020-02-15 00:00:00.000000000 Z
13
+ date: 2020-05-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop
@@ -123,6 +123,7 @@ files:
123
123
  - lib/rubocop/cop/rspec/before_after_all.rb
124
124
  - lib/rubocop/cop/rspec/capybara/current_path_expectation.rb
125
125
  - lib/rubocop/cop/rspec/capybara/feature_methods.rb
126
+ - lib/rubocop/cop/rspec/capybara/visibility_matcher.rb
126
127
  - lib/rubocop/cop/rspec/context_method.rb
127
128
  - lib/rubocop/cop/rspec/context_wording.rb
128
129
  - lib/rubocop/cop/rspec/cop.rb
@@ -133,6 +134,7 @@ files:
133
134
  - lib/rubocop/cop/rspec/described_class_module_wrapping.rb
134
135
  - lib/rubocop/cop/rspec/dialect.rb
135
136
  - lib/rubocop/cop/rspec/empty_example_group.rb
137
+ - lib/rubocop/cop/rspec/empty_hook.rb
136
138
  - lib/rubocop/cop/rspec/empty_line_after_example.rb
137
139
  - lib/rubocop/cop/rspec/empty_line_after_example_group.rb
138
140
  - lib/rubocop/cop/rspec/empty_line_after_final_let.rb
@@ -201,6 +203,7 @@ files:
201
203
  - lib/rubocop/rspec/blank_line_separation.rb
202
204
  - lib/rubocop/rspec/concept.rb
203
205
  - lib/rubocop/rspec/config_formatter.rb
206
+ - lib/rubocop/rspec/corrector/move_node.rb
204
207
  - lib/rubocop/rspec/description_extractor.rb
205
208
  - lib/rubocop/rspec/example.rb
206
209
  - lib/rubocop/rspec/example_group.rb
@@ -212,7 +215,6 @@ files:
212
215
  - lib/rubocop/rspec/language/node_pattern.rb
213
216
  - lib/rubocop/rspec/node.rb
214
217
  - lib/rubocop/rspec/top_level_describe.rb
215
- - lib/rubocop/rspec/util.rb
216
218
  - lib/rubocop/rspec/version.rb
217
219
  - lib/rubocop/rspec/wording.rb
218
220
  homepage: https://github.com/rubocop-hq/rubocop-rspec
@@ -229,14 +231,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
231
  requirements:
230
232
  - - ">="
231
233
  - !ruby/object:Gem::Version
232
- version: 2.3.0
234
+ version: 2.4.0
233
235
  required_rubygems_version: !ruby/object:Gem::Requirement
234
236
  requirements:
235
237
  - - ">="
236
238
  - !ruby/object:Gem::Version
237
239
  version: '0'
238
240
  requirements: []
239
- rubygems_version: 3.1.1
241
+ rubygems_version: 3.1.2
240
242
  signing_key:
241
243
  specification_version: 4
242
244
  summary: Code style checking for RSpec 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